From: Jan Pospíšil Date: Fri, 30 Sep 2005 09:13:45 +0000 (+0000) Subject: Bug#11050: X-Git-Tag: gridsite-core_R_1_1_12~71 X-Git-Url: http://scientific.zcu.cz/git/?a=commitdiff_plain;h=5d7586552ba1cc867eaf193ab3d5027ef93f0cec;p=jra1mw.git Bug#11050: - better connection timeout handling (do not sleep longer than timeout) --- diff --git a/org.glite.lb.common/src/log_msg.c b/org.glite.lb.common/src/log_msg.c index 324b56d..befa8cd 100644 --- a/org.glite.lb.common/src/log_msg.c +++ b/org.glite.lb.common/src/log_msg.c @@ -1,5 +1,6 @@ #include #include +#include #include "context-int.h" @@ -194,6 +195,7 @@ int edg_wll_log_event_send( struct sockaddr_un saddr; int msg_sock, flags, + conn_timeout, i, count = 0; @@ -212,11 +214,13 @@ int edg_wll_log_event_send( goto cleanup; } + conn_timeout = floor(timeout->tv_sec/(conn_attempts + 1)); for ( i = 0; i < conn_attempts; i++) { if ( connect(msg_sock, (struct sockaddr *)&saddr, sizeof(saddr)) < 0 ) { if ( errno == EISCONN ) break; else if ((errno == EAGAIN) || (errno == ETIMEDOUT)) { - sleep(timeout->tv_sec); + sleep(conn_timeout); + timeout->tv_sec -= conn_timeout; continue; } else { edg_wll_SetError(ctx, errno, "Can't connect to the interlogger");