| 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 671 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 682 } | 682 } |
| 683 | 683 |
| 684 int SSLServerSocketNSS::DoHandshake() { | 684 int SSLServerSocketNSS::DoHandshake() { |
| 685 int net_error = OK; | 685 int net_error = OK; |
| 686 SECStatus rv = SSL_ForceHandshake(nss_fd_); | 686 SECStatus rv = SSL_ForceHandshake(nss_fd_); |
| 687 | 687 |
| 688 if (rv == SECSuccess) { | 688 if (rv == SECSuccess) { |
| 689 completed_handshake_ = true; | 689 completed_handshake_ = true; |
| 690 } else { | 690 } else { |
| 691 PRErrorCode prerr = PR_GetError(); | 691 PRErrorCode prerr = PR_GetError(); |
| 692 net_error = MapNSSHandshakeError(prerr); | 692 net_error = MapNSSError(prerr); |
| 693 | 693 |
| 694 // If not done, stay in this state | 694 // If not done, stay in this state |
| 695 if (net_error == ERR_IO_PENDING) { | 695 if (net_error == ERR_IO_PENDING) { |
| 696 GotoState(STATE_HANDSHAKE); | 696 GotoState(STATE_HANDSHAKE); |
| 697 } else { | 697 } else { |
| 698 LOG(ERROR) << "handshake failed; NSS error code " << prerr | 698 LOG(ERROR) << "handshake failed; NSS error code " << prerr |
| 699 << ", net_error " << net_error; | 699 << ", net_error " << net_error; |
| 700 net_log_.AddEvent( | 700 net_log_.AddEvent( |
| 701 NetLog::TYPE_SSL_HANDSHAKE_ERROR, | 701 NetLog::TYPE_SSL_HANDSHAKE_ERROR, |
| 702 make_scoped_refptr(new SSLErrorParams(net_error, prerr))); | 702 make_scoped_refptr(new SSLErrorParams(net_error, prerr))); |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 766 // Initialize the NSS SSL library in a threadsafe way. This also | 766 // Initialize the NSS SSL library in a threadsafe way. This also |
| 767 // initializes the NSS base library. | 767 // initializes the NSS base library. |
| 768 EnsureNSSSSLInit(); | 768 EnsureNSSSSLInit(); |
| 769 if (!NSS_IsInitialized()) | 769 if (!NSS_IsInitialized()) |
| 770 return ERR_UNEXPECTED; | 770 return ERR_UNEXPECTED; |
| 771 | 771 |
| 772 return OK; | 772 return OK; |
| 773 } | 773 } |
| 774 | 774 |
| 775 } // namespace net | 775 } // namespace net |
| OLD | NEW |