Skip to content

Commit

Permalink
Update example_echosvr.cpp
Browse files Browse the repository at this point in the history
none blocking socket should process EAGAIN
  • Loading branch information
priest334 authored Apr 26, 2017
1 parent d7c6dd8 commit b369ae4
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions example_echosvr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
#include <fcntl.h>
#include <arpa/inet.h>
#include <unistd.h>
#include <errno.h>

using namespace std;
struct task_t
Expand Down Expand Up @@ -86,6 +87,9 @@ static void *readwrite_routine( void *arg )
}
if( ret <= 0 )
{
// accept_routine->SetNonBlock(fd) cause EAGAIN, we should continue
if (errno == EAGAIN)
continue;
close( fd );
break;
}
Expand Down

0 comments on commit b369ae4

Please sign in to comment.