Support for "polling" select in sock_read_write.

Currently, in sock_read_write function, if the timeout is 0, pupnp
realizes a "blocking" select (with an infinite timeout). With this
patch, if timeout is set to 0, pupnp will realize a "polling" select
and returns immediately if it can not read or write on the socket. This
is very useful for GENA notifications when pupnp is trying to send
events to a disconnected Control Point. "Blocking" select can now be
done by putting a negative timeout value.
This commit is contained in:
Fabrice Fontaine
2010-11-11 21:21:50 -02:00
committed by Marcelo Roberto Jimenez
parent 1fd443f79f
commit 6c64b7eeb5
4 changed files with 25 additions and 13 deletions

View File

@@ -1324,7 +1324,7 @@ static int http_RecvPostMessage(
{
unsigned int Data_Buf_Size = 1024;
char Buf[1024];
int Timeout = 0;
int Timeout = -1;
long Num_Write = 0;
FILE *Fp;
parse_status_t status = PARSE_OK;
@@ -1456,7 +1456,7 @@ void web_server_callback(http_parser_t *parser, INOUT http_message_t *req,
SOCKINFO *info)
{
int ret;
int timeout = 0;
int timeout = -1;
enum resp_type rtype = 0;
membuffer headers;
membuffer filename;