diff options
Diffstat (limited to 'server/main.c')
-rw-r--r-- | server/main.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/server/main.c b/server/main.c index 3cf1ffd..ffa16cd 100644 --- a/server/main.c +++ b/server/main.c @@ -69,6 +69,7 @@ static void connection_handler(int sock){ break; } if(ret==0||!FD_ISSET(sock,&inset)){ // timeout + before=make_timestamp(); if(do_send_frames){ if(data_stream_frame(stream)<0){ printf("Error sending data\n"); @@ -77,6 +78,14 @@ static void connection_handler(int sock){ printf("."); fflush(stdout); } timeleft=polldelay; + + i64 after=make_timestamp(); + if(after<before){ + printf("Time ran backwards?\n"); + after=before; + } + timeleft-=after-before; + if(timeleft<0)timeleft=0; continue; } |