projects
/
tedtools.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
ad99278
)
add timeout to TC_ServerConnect
author
teodor
<teodor>
Wed, 29 Sep 2004 17:34:30 +0000
(17:34 +0000)
committer
teodor
<teodor>
Wed, 29 Sep 2004 17:34:30 +0000
(17:34 +0000)
connection.h
patch
|
blob
|
history
tcp.c
patch
|
blob
|
history
diff --git
a/connection.h
b/connection.h
index
2bc936d
..
7c0db10
100644
(file)
--- a/
connection.h
+++ b/
connection.h
@@
-79,7
+79,7
@@
TC_Connection *TC_fillConnection( TC_Connection *cs, char *name, u_int32_t port
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 );
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 );
u_int32_t TC_Send( TC_Connection *cs );
u_int32_t TC_Read( TC_Connection *cs );
u_int32_t TC_Talk( TC_Connection *cs );
diff --git
a/tcp.c
b/tcp.c
index
26afeaf
..
df10a46
100644
(file)
--- a/
tcp.c
+++ b/
tcp.c
@@
-208,12
+208,12
@@
TC_ServerInitConnect( TC_Connection *cs ) {
}
cs->state = CS_INPROCESS;
}
cs->state = CS_INPROCESS;
- return TC_ServerConnect( cs );
+ return TC_ServerConnect( cs
, 0
);
}
u_int32_t
}
u_int32_t
-TC_ServerConnect( TC_Connection *cs ) {
+TC_ServerConnect( TC_Connection *cs
, int timeout
) {
struct pollfd pfd;
int ret;
struct pollfd pfd;
int ret;
@@
-223,7
+223,7
@@
TC_ServerConnect( TC_Connection *cs ) {
pfd.fd = cs->fd;
pfd.events = POLLOUT;
pfd.revents = 0;
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));
if ( ret<0 ) {
tlog( TL_CRIT, "TC_ServerConnect: poll: %s",
strerror(errno));
@@
-426,7
+426,7
@@
TC_Talk( TC_Connection *cs ) {
u_int32_t ret = TC_ServerInitConnect( cs );
while( ret == CS_INPROCESS ) {
u_int32_t ret = TC_ServerInitConnect( cs );
while( ret == CS_INPROCESS ) {
- ret = TC_ServerConnect(cs);
+ ret = TC_ServerConnect(cs
, 100
);
}
if ( ret != CS_CONNECTED )
}
if ( ret != CS_CONNECTED )