diff options
Diffstat (limited to 'src/Sockets.c')
-rw-r--r-- | src/Sockets.c | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/src/Sockets.c b/src/Sockets.c index 9ed6a7a..3b00005 100644 --- a/src/Sockets.c +++ b/src/Sockets.c @@ -312,7 +312,7 @@ int HTTP_Write(httpRequest *request, const char *buffer, size_t count) connection = (httpSocket *)request->connection; - if(connection->state = open) + if(connection->state == open) { FD_ZERO (&this_set); done = 0; @@ -454,12 +454,19 @@ int HTTP_Read(httpRequest *request, char *buffer, size_t count) connection = (httpSocket *)request->connection; - /* Currently don't do anything fancy. */ - retval = recv(connection->filedes, buffer, count,MSG_NOSIGNAL); + if(connection->state == open) + { + /* Currently don't do anything fancy. */ + retval = recv(connection->filedes, buffer, count,MSG_NOSIGNAL); #ifdef HTTP_DEBUG - fprintf (stderr, "Read: `%s'\n", buffer); + fprintf (stderr, "Read: `%s'\n", buffer); #endif + } + else + { + retval = -1; + } return retval; } @@ -604,7 +611,7 @@ static void SocketDestroy(httpSocket *this) { if(this) { - if(this->state = open) + if(this->state == open) { SocketClose(this); } |