io.c: Fix rebuffering issue on win32 (fixing #235)

webserver.c: Fix write error log messages.  Possible fix for crash on mipsel (uninitialized heap issue).
This commit is contained in:
Ron Pedde
2007-09-23 10:14:51 +00:00
parent 4966f4213e
commit 01c7d18758
6 changed files with 17 additions and 13 deletions

View File

@@ -2148,6 +2148,9 @@ int io_listen_accept(IO_PRIVHANDLE *phandle, IO_PRIVHANDLE *pchild,
struct sockaddr_in client;
SOCKET_T child_fd;
IO_SOCKET_PRIV *priv;
#ifdef WIN32
long blocking = 0;
#endif
ASSERT(phandle);
ASSERT(pchild);
@@ -2176,6 +2179,12 @@ int io_listen_accept(IO_PRIVHANDLE *phandle, IO_PRIVHANDLE *pchild,
return FALSE;
}
#ifdef WIN32
if(ioctlsocket(child_fd,FIONBIO,&blocking)) {
io_err_printf(IO_LOG_LOG,"Couldn't set socket to blocking\n");
}
#endif
io_err_printf(IO_LOG_DEBUG,"Got listen socket %d\n",child_fd);
/* copy host, if passed a buffer */
@@ -2277,7 +2286,7 @@ int io_socket_write(IO_PRIVHANDLE *phandle, unsigned char *buf,uint32_t *len) {
int slen;
uint32_t bytestowrite;
ssize_t byteswritten;
ssize_t byteswritten=0;
uint32_t totalbytes;
unsigned char *bufp;
@@ -2318,8 +2327,10 @@ int io_socket_write(IO_PRIVHANDLE *phandle, unsigned char *buf,uint32_t *len) {
#endif
if((byteswritten == -1 ) && (errno != EINTR)) {
io_socket_seterr(phandle,IO_E_SOCKET_OTHER);
*len = totalbytes;
return FALSE;
}
if(byteswritten == -1)
byteswritten = 0;
totalbytes += byteswritten;

View File

@@ -1203,7 +1203,7 @@ int ws_writefd(WS_CONNINFO *pwsc, char *fmt, ...) {
}
WS_EXIT();
return len;
return (int)len;
}
/**

View File

@@ -75,6 +75,7 @@ typedef INT64 int64_t;
#define strncasecmp strnicmp
#define strcasecmp stricmp
#define snprintf _snprintf
#define vsnprintf _vsnprintf
#define access _access
#define readdir_r os_readdir_r