diff options
Diffstat (limited to 'pr/src/md/windows/w95sock.c')
-rw-r--r-- | pr/src/md/windows/w95sock.c | 76 |
1 files changed, 38 insertions, 38 deletions
diff --git a/pr/src/md/windows/w95sock.c b/pr/src/md/windows/w95sock.c index c6a3ec11..10423e98 100644 --- a/pr/src/md/windows/w95sock.c +++ b/pr/src/md/windows/w95sock.c @@ -14,7 +14,7 @@ #define CONNECT_FD 3 static PRInt32 socket_io_wait( - PROsfd osfd, + PROsfd osfd, PRInt32 fd_type, PRIntervalTime timeout); @@ -51,7 +51,7 @@ _PR_MD_SOCKET(int af, int type, int flags) sock = socket(af, type, flags); - if (sock == INVALID_SOCKET ) + if (sock == INVALID_SOCKET ) { _PR_MD_MAP_SOCKET_ERROR(WSAGetLastError()); return (PROsfd)sock; @@ -120,8 +120,8 @@ _MD_SocketAvailable(PRFileDesc *fd) } PROsfd _MD_Accept( - PRFileDesc *fd, - PRNetAddr *raddr, + PRFileDesc *fd, + PRNetAddr *raddr, PRUint32 *rlen, PRIntervalTime timeout ) { @@ -129,7 +129,7 @@ PROsfd _MD_Accept( SOCKET sock; PRInt32 rv, err; - while ((sock = accept(osfd, (struct sockaddr *) raddr, rlen)) == -1) + while ((sock = accept(osfd, (struct sockaddr *) raddr, rlen)) == -1) { err = WSAGetLastError(); if ((err == WSAEWOULDBLOCK) && (!fd->secret->nonblocking)) @@ -149,14 +149,14 @@ PROsfd _MD_Accept( } /* end _MD_accept() */ PRInt32 -_PR_MD_CONNECT(PRFileDesc *fd, const PRNetAddr *addr, PRUint32 addrlen, +_PR_MD_CONNECT(PRFileDesc *fd, const PRNetAddr *addr, PRUint32 addrlen, PRIntervalTime timeout) { PROsfd osfd = fd->secret->md.osfd; PRInt32 rv; int err; - if ((rv = connect(osfd, (struct sockaddr *) addr, addrlen)) == -1) + if ((rv = connect(osfd, (struct sockaddr *) addr, addrlen)) == -1) { err = WSAGetLastError(); if ((!fd->secret->nonblocking) && (err == WSAEWOULDBLOCK)) @@ -171,7 +171,7 @@ _PR_MD_CONNECT(PRFileDesc *fd, const PRNetAddr *addr, PRUint32 addrlen, PR_ASSERT(rv > 0); /* it's connected */ return(0); - } + } } _PR_MD_MAP_CONNECT_ERROR(err); } @@ -209,7 +209,7 @@ _PR_MD_LISTEN(PRFileDesc *fd, PRIntn backlog) } PRInt32 -_PR_MD_RECV(PRFileDesc *fd, void *buf, PRInt32 amount, PRIntn flags, +_PR_MD_RECV(PRFileDesc *fd, void *buf, PRInt32 amount, PRIntn flags, PRIntervalTime timeout) { PROsfd osfd = fd->secret->md.osfd; @@ -222,18 +222,18 @@ _PR_MD_RECV(PRFileDesc *fd, void *buf, PRInt32 amount, PRIntn flags, PR_ASSERT(PR_MSG_PEEK == flags); osflags = MSG_PEEK; } - while ((rv = recv( osfd, buf, amount, osflags)) == -1) + while ((rv = recv( osfd, buf, amount, osflags)) == -1) { - if (((err = WSAGetLastError()) == WSAEWOULDBLOCK) + if (((err = WSAGetLastError()) == WSAEWOULDBLOCK) && (!fd->secret->nonblocking)) { rv = socket_io_wait(osfd, READ_FD, timeout); if ( rv < 0 ) { return -1; - } - } - else + } + } + else { _PR_MD_MAP_RECV_ERROR(err); break; @@ -250,11 +250,11 @@ _PR_MD_SEND(PRFileDesc *fd, const void *buf, PRInt32 amount, PRIntn flags, PRInt32 rv, err; PRInt32 bytesSent = 0; - while(bytesSent < amount ) + while(bytesSent < amount ) { - while ((rv = send( osfd, buf, amount, 0 )) == -1) + while ((rv = send( osfd, buf, amount, 0 )) == -1) { - if (((err = WSAGetLastError()) == WSAEWOULDBLOCK) + if (((err = WSAGetLastError()) == WSAEWOULDBLOCK) && (!fd->secret->nonblocking)) { rv = socket_io_wait(osfd, WRITE_FD, timeout); @@ -262,8 +262,8 @@ _PR_MD_SEND(PRFileDesc *fd, const void *buf, PRInt32 amount, PRIntn flags, { return -1; } - } - else + } + else { _PR_MD_MAP_SEND_ERROR(err); return -1; @@ -274,7 +274,7 @@ _PR_MD_SEND(PRFileDesc *fd, const void *buf, PRInt32 amount, PRIntn flags, { break; } - if (bytesSent < amount) + if (bytesSent < amount) { rv = socket_io_wait(osfd, WRITE_FD, timeout); if ( rv < 0 ) @@ -296,9 +296,9 @@ _PR_MD_SENDTO(PRFileDesc *fd, const void *buf, PRInt32 amount, PRIntn flags, do { while ((rv = sendto( osfd, buf, amount, 0, (struct sockaddr *) addr, - addrlen)) == -1) + addrlen)) == -1) { - if (((err = WSAGetLastError()) == WSAEWOULDBLOCK) + if (((err = WSAGetLastError()) == WSAEWOULDBLOCK) && (!fd->secret->nonblocking)) { rv = socket_io_wait(osfd, WRITE_FD, timeout); @@ -306,8 +306,8 @@ _PR_MD_SENDTO(PRFileDesc *fd, const void *buf, PRInt32 amount, PRIntn flags, { return -1; } - } - else + } + else { _PR_MD_MAP_SENDTO_ERROR(err); return -1; @@ -318,10 +318,10 @@ _PR_MD_SENDTO(PRFileDesc *fd, const void *buf, PRInt32 amount, PRIntn flags, { break; } - if (bytesSent < amount) + if (bytesSent < amount) { rv = socket_io_wait(osfd, WRITE_FD, timeout); - if (rv < 0) + if (rv < 0) { return -1; } @@ -510,18 +510,18 @@ _PR_MD_RECVFROM(PRFileDesc *fd, void *buf, PRInt32 amount, PRIntn flags, PRInt32 rv, err; while ((rv = recvfrom( osfd, buf, amount, 0, (struct sockaddr *) addr, - addrlen)) == -1) + addrlen)) == -1) { - if (((err = WSAGetLastError()) == WSAEWOULDBLOCK) + if (((err = WSAGetLastError()) == WSAEWOULDBLOCK) && (!fd->secret->nonblocking)) { rv = socket_io_wait(osfd, READ_FD, timeout); if ( rv < 0) { return -1; - } - } - else + } + } + else { _PR_MD_MAP_RECVFROM_ERROR(err); break; @@ -537,12 +537,12 @@ _PR_MD_WRITEV(PRFileDesc *fd, const PRIOVec *iov, PRInt32 iov_size, PRIntervalTi int sent = 0; int rv; - for (index=0; index < iov_size; index++) + for (index=0; index < iov_size; index++) { rv = _PR_MD_SEND(fd, iov[index].iov_base, iov[index].iov_len, 0, timeout); - if (rv > 0) + if (rv > 0) sent += rv; - if ( rv != iov[index].iov_len ) + if ( rv != iov[index].iov_len ) { if (rv < 0) { @@ -651,7 +651,7 @@ _MD_MakeNonblock(PRFileDesc *f) #define _PR_INTERRUPT_CHECK_INTERVAL_SECS 5 static PRInt32 socket_io_wait( - PROsfd osfd, + PROsfd osfd, PRInt32 fd_type, PRIntervalTime timeout) { @@ -710,7 +710,7 @@ static PRInt32 socket_io_wait( len = sizeof(err); if (getsockopt(osfd, SOL_SOCKET, SO_ERROR, (char *) &err, &len) == SOCKET_ERROR) - { + { _PR_MD_MAP_GETSOCKOPT_ERROR(WSAGetLastError()); return -1; } @@ -790,7 +790,7 @@ static PRInt32 socket_io_wait( len = sizeof(err); if (getsockopt(osfd, SOL_SOCKET, SO_ERROR, (char *) &err, &len) == SOCKET_ERROR) - { + { _PR_MD_MAP_GETSOCKOPT_ERROR(WSAGetLastError()); return -1; } @@ -822,7 +822,7 @@ static PRInt32 socket_io_wait( if (wait_for_remaining) { elapsed = remaining; } else { - elapsed = PR_SecondsToInterval(tv.tv_sec) + elapsed = PR_SecondsToInterval(tv.tv_sec) + PR_MicrosecondsToInterval(tv.tv_usec); } if (elapsed >= remaining) { |