aboutsummaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorcnlohr <lohr85@gmail.com>2017-02-26 00:14:48 -0500
committercnlohr <lohr85@gmail.com>2017-02-26 00:14:48 -0500
commitf4ab8c084c1e23e850f436c2c0bb6777da3d942a (patch)
treee5b92a7f19ddb69320610aec46b1b6c8d05dcef0 /tools
parent55cedfc6a6b035d6eb54457782818fef61cae500 (diff)
parentfe31e600d890004f0f255a20fe056e0e8a54209b (diff)
downloadlibsurvive-f4ab8c084c1e23e850f436c2c0bb6777da3d942a.tar.gz
libsurvive-f4ab8c084c1e23e850f436c2c0bb6777da3d942a.tar.bz2
Merge branch 'master' of https://github.com/cnlohr/libsurvive
Diffstat (limited to 'tools')
-rw-r--r--tools/data_server/data_server.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/tools/data_server/data_server.c b/tools/data_server/data_server.c
index 29f5ead..5147d97 100644
--- a/tools/data_server/data_server.c
+++ b/tools/data_server/data_server.c
@@ -19,6 +19,7 @@
#define MAX_CONNS 32
int SocketList[MAX_CONNS];
+int droppedct[MAX_CONNS];
void error(char *msg) {
perror(msg);
@@ -44,10 +45,17 @@ void * SendThread( void * v )
int ss = send( sockc, buff, rd, MSG_DONTWAIT | MSG_NOSIGNAL );
if( ss < rd )
{
- fprintf( stderr, "Dropped %d\n", i );
- close( SocketList[i] );
- SocketList[i] = 0;
+ if( droppedct[i]++ > 20 )
+ {
+ fprintf( stderr, "Dropped %d\n", i );
+ close( SocketList[i] );
+ SocketList[i] = 0;
+ }
}
+ else
+ {
+ droppedct[i] = 0;
+ }
}
}
}
@@ -142,6 +150,7 @@ int main( int argc, char ** argv )
if( SocketList[il] == 0 )
{
SocketList[il] = childfd;
+ droppedct[il] = 0;
printf("Conn %s At %d\n",
hostaddrp, il);
break;