Add debugging to try and find problems with EBADF on Sun Cobalt RaQ

This commit is contained in:
Ron Pedde 2007-09-07 06:52:23 +00:00
parent 64b8eb7e71
commit 06a107f116
2 changed files with 7 additions and 3 deletions

View File

@ -2171,6 +2171,8 @@ int io_listen_accept(IO_PRIVHANDLE *phandle, IO_PRIVHANDLE *pchild,
return FALSE;
}
io_err_printf(IO_LOG_DEBUG,"Got listen socket %d\n",child_fd);
/* copy host, if passed a buffer */
if(host)
*host = client.sin_addr;
@ -2290,6 +2292,8 @@ int io_socket_write(IO_PRIVHANDLE *phandle, unsigned char *buf,uint32_t *len) {
return FALSE;
}
io_err_printf(IO_LOG_DEBUG,"writing to socket %d\n",priv->fd);
for(bufp = buf, bytestowrite = *len, totalbytes=0;
bytestowrite > 0;
bufp += byteswritten, bytestowrite -= byteswritten) {

View File

@ -1189,12 +1189,12 @@ int ws_writefd(WS_CONNINFO *pwsc, char *fmt, ...) {
WS_ENTER();
va_start(ap, fmt);
vsnprintf(buffer, 1024, fmt, ap);
vsnprintf(buffer, sizeof(buffer), fmt, ap);
va_end(ap);
len = (uint32_t)strlen(buffer);
if(!io_write(pwsc->hclient,(unsigned char *)buffer,&len)) {
ws_dprintf(L_WS_LOG,"Error writing to client socket: %s",
ws_dprintf(L_WS_LOG,"Error writing to client socket: %s\n",
io_errstr(pwsc->hclient));
}
@ -1216,7 +1216,7 @@ int ws_writebinary(WS_CONNINFO *pwsc, char *data, int len) {
WS_ENTER();
bytes_written = (uint32_t) len;
if(!io_write(pwsc->hclient, (unsigned char *)data, &bytes_written)) {
ws_dprintf(L_WS_LOG,"Error writing to client socket: %s",
ws_dprintf(L_WS_LOG,"Error writing to client socket: %s\n",
io_errstr(pwsc->hclient));
}