diff options
Diffstat (limited to 'net/socket/ssl_server_socket_nss.cc')
-rw-r--r-- | net/socket/ssl_server_socket_nss.cc | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/net/socket/ssl_server_socket_nss.cc b/net/socket/ssl_server_socket_nss.cc index bdcff2c..83a382e 100644 --- a/net/socket/ssl_server_socket_nss.cc +++ b/net/socket/ssl_server_socket_nss.cc @@ -528,14 +528,22 @@ void SSLServerSocketNSS::BufferRecvComplete(int result) { OnRecvComplete(result); } -// Do network I/O between the given buffer and the given socket. -// Return true if some I/O performed, false otherwise (error or ERR_IO_PENDING) +// Do as much network I/O as possible between the buffer and the +// transport socket. Return true if some I/O performed, false +// otherwise (error or ERR_IO_PENDING). bool SSLServerSocketNSS::DoTransportIO() { bool network_moved = false; if (nss_bufs_ != NULL) { - int nsent = BufferSend(); - int nreceived = BufferRecv(); - network_moved = (nsent > 0 || nreceived >= 0); + int rv; + // Read and write as much data as we can. The loop is neccessary + // because Write() may return synchronously. + do { + rv = BufferSend(); + if (rv > 0) + network_moved = true; + } while (rv > 0); + if (BufferRecv() >= 0) + network_moved = true; } return network_moved; } |