| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "net/socket/ssl_server_socket_nss.h" | 5 #include "net/socket/ssl_server_socket_nss.h" |
| 6 | 6 |
| 7 #if defined(OS_WIN) | 7 #if defined(OS_WIN) |
| 8 #include <winsock2.h> | 8 #include <winsock2.h> |
| 9 #endif | 9 #endif |
| 10 | 10 |
| (...skipping 515 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 526 memio_PutReadResult(nss_bufs_, MapErrorToNSS(result)); | 526 memio_PutReadResult(nss_bufs_, MapErrorToNSS(result)); |
| 527 transport_recv_busy_ = false; | 527 transport_recv_busy_ = false; |
| 528 OnRecvComplete(result); | 528 OnRecvComplete(result); |
| 529 } | 529 } |
| 530 | 530 |
| 531 // Do network I/O between the given buffer and the given socket. | 531 // Do network I/O between the given buffer and the given socket. |
| 532 // Return true if some I/O performed, false otherwise (error or ERR_IO_PENDING) | 532 // Return true if some I/O performed, false otherwise (error or ERR_IO_PENDING) |
| 533 bool SSLServerSocketNSS::DoTransportIO() { | 533 bool SSLServerSocketNSS::DoTransportIO() { |
| 534 bool network_moved = false; | 534 bool network_moved = false; |
| 535 if (nss_bufs_ != NULL) { | 535 if (nss_bufs_ != NULL) { |
| 536 int nsent = BufferSend(); | 536 int rv; |
| 537 int nreceived = BufferRecv(); | 537 do { |
| 538 network_moved = (nsent > 0 || nreceived >= 0); | 538 rv = BufferSend(); |
| 539 if (rv > 0) |
| 540 network_moved = true; |
| 541 } while (rv > 0); |
| 542 do { |
| 543 rv = BufferRecv(); |
| 544 if (rv >= 0) |
| 545 network_moved = true; |
| 546 } while (rv > 0); |
| 539 } | 547 } |
| 540 return network_moved; | 548 return network_moved; |
| 541 } | 549 } |
| 542 | 550 |
| 543 int SSLServerSocketNSS::DoPayloadRead() { | 551 int SSLServerSocketNSS::DoPayloadRead() { |
| 544 DCHECK(user_read_buf_); | 552 DCHECK(user_read_buf_); |
| 545 DCHECK_GT(user_read_buf_len_, 0); | 553 DCHECK_GT(user_read_buf_len_, 0); |
| 546 int rv = PR_Read(nss_fd_, user_read_buf_->data(), user_read_buf_len_); | 554 int rv = PR_Read(nss_fd_, user_read_buf_->data(), user_read_buf_len_); |
| 547 if (rv >= 0) | 555 if (rv >= 0) |
| 548 return rv; | 556 return rv; |
| (...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 741 // We must call EnsureOCSPInit() here, on the IO thread, to get the IO loop | 749 // We must call EnsureOCSPInit() here, on the IO thread, to get the IO loop |
| 742 // by MessageLoopForIO::current(). | 750 // by MessageLoopForIO::current(). |
| 743 // X509Certificate::Verify() runs on a worker thread of CertVerifier. | 751 // X509Certificate::Verify() runs on a worker thread of CertVerifier. |
| 744 EnsureOCSPInit(); | 752 EnsureOCSPInit(); |
| 745 #endif | 753 #endif |
| 746 | 754 |
| 747 return OK; | 755 return OK; |
| 748 } | 756 } |
| 749 | 757 |
| 750 } // namespace net | 758 } // namespace net |
| OLD | NEW |