TC_Connection* TC_AcceptTcp(TC_Connection *cs);
u_int32_t TC_ClientInitConnection(TC_Connection *cs, char *name, u_int32_t port);
u_int32_t TC_ServerInitConnect( TC_Connection *cs );
-u_int32_t TC_ServerConnect( TC_Connection *cs );
+u_int32_t TC_ServerConnect( TC_Connection *cs, int timeout );
u_int32_t TC_Send( TC_Connection *cs );
u_int32_t TC_Read( TC_Connection *cs );
u_int32_t TC_Talk( TC_Connection *cs );
}
cs->state = CS_INPROCESS;
- return TC_ServerConnect( cs );
+ return TC_ServerConnect( cs, 0 );
}
u_int32_t
-TC_ServerConnect( TC_Connection *cs ) {
+TC_ServerConnect( TC_Connection *cs, int timeout ) {
struct pollfd pfd;
int ret;
pfd.fd = cs->fd;
pfd.events = POLLOUT;
pfd.revents = 0;
- ret = poll( &pfd, 1, 0 );
+ ret = poll( &pfd, 1, timeout );
if ( ret<0 ) {
tlog( TL_CRIT, "TC_ServerConnect: poll: %s",
strerror(errno));
u_int32_t ret = TC_ServerInitConnect( cs );
while( ret == CS_INPROCESS ) {
- ret = TC_ServerConnect(cs);
+ ret = TC_ServerConnect(cs, 100);
}
if ( ret != CS_CONNECTED )