OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 535 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
546 // Return 0 for EOF, | 546 // Return 0 for EOF, |
547 // > 0 for bytes transferred immediately, | 547 // > 0 for bytes transferred immediately, |
548 // < 0 for error (or the non-error ERR_IO_PENDING). | 548 // < 0 for error (or the non-error ERR_IO_PENDING). |
549 int SSLServerSocketNSS::BufferSend(void) { | 549 int SSLServerSocketNSS::BufferSend(void) { |
550 if (transport_send_busy_) | 550 if (transport_send_busy_) |
551 return ERR_IO_PENDING; | 551 return ERR_IO_PENDING; |
552 | 552 |
553 const char* buf1; | 553 const char* buf1; |
554 const char* buf2; | 554 const char* buf2; |
555 unsigned int len1, len2; | 555 unsigned int len1, len2; |
556 memio_GetWriteParams(nss_bufs_, &buf1, &len1, &buf2, &len2); | 556 if (memio_GetWriteParams(nss_bufs_, &buf1, &len1, &buf2, &len2)) { |
| 557 // The error code itself is ignored, so just return ERR_ABORTED. |
| 558 return ERR_ABORTED; |
| 559 } |
557 const unsigned int len = len1 + len2; | 560 const unsigned int len = len1 + len2; |
558 | 561 |
559 int rv = 0; | 562 int rv = 0; |
560 if (len) { | 563 if (len) { |
561 scoped_refptr<IOBuffer> send_buffer(new IOBuffer(len)); | 564 scoped_refptr<IOBuffer> send_buffer(new IOBuffer(len)); |
562 memcpy(send_buffer->data(), buf1, len1); | 565 memcpy(send_buffer->data(), buf1, len1); |
563 memcpy(send_buffer->data() + len1, buf2, len2); | 566 memcpy(send_buffer->data() + len1, buf2, len2); |
564 rv = transport_socket_->Write( | 567 rv = transport_socket_->Write( |
565 send_buffer.get(), | 568 send_buffer.get(), |
566 len, | 569 len, |
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
828 // initializes the NSS base library. | 831 // initializes the NSS base library. |
829 EnsureNSSSSLInit(); | 832 EnsureNSSSSLInit(); |
830 if (!NSS_IsInitialized()) | 833 if (!NSS_IsInitialized()) |
831 return ERR_UNEXPECTED; | 834 return ERR_UNEXPECTED; |
832 | 835 |
833 EnableSSLServerSockets(); | 836 EnableSSLServerSockets(); |
834 return OK; | 837 return OK; |
835 } | 838 } |
836 | 839 |
837 } // namespace net | 840 } // namespace net |
OLD | NEW |