OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "chrome/common/net/notifier/communicator/ssl_socket_adapter.h" | 5 #include "chrome/common/net/notifier/communicator/ssl_socket_adapter.h" |
6 | 6 |
7 #include "base/compiler_specific.h" | 7 #include "base/compiler_specific.h" |
8 #include "base/message_loop.h" | 8 #include "base/message_loop.h" |
9 #include "net/base/address_list.h" | 9 #include "net/base/address_list.h" |
10 #include "net/base/net_errors.h" | 10 #include "net/base/net_errors.h" |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
88 // SSL connection just hangs silently. | 88 // SSL connection just hangs silently. |
89 LOG(DFATAL) << "Chrome message loop (needed by SSL certificate " | 89 LOG(DFATAL) << "Chrome message loop (needed by SSL certificate " |
90 << "verification) does not exist"; | 90 << "verification) does not exist"; |
91 return net::ERR_UNEXPECTED; | 91 return net::ERR_UNEXPECTED; |
92 } | 92 } |
93 | 93 |
94 // SSLConfigService is not thread-safe, and the default values for SSLConfig | 94 // SSLConfigService is not thread-safe, and the default values for SSLConfig |
95 // are correct for us, so we don't use the config service to initialize this | 95 // are correct for us, so we don't use the config service to initialize this |
96 // object. | 96 // object. |
97 net::SSLConfig ssl_config; | 97 net::SSLConfig ssl_config; |
98 transport_socket_->set_addr(talk_base::SocketAddress(hostname_.c_str())); | 98 transport_socket_->set_addr(talk_base::SocketAddress(hostname_, 0)); |
99 ssl_socket_.reset( | 99 ssl_socket_.reset( |
100 net::ClientSocketFactory::GetDefaultFactory()->CreateSSLClientSocket( | 100 net::ClientSocketFactory::GetDefaultFactory()->CreateSSLClientSocket( |
101 transport_socket_, hostname_.c_str(), ssl_config)); | 101 transport_socket_, hostname_.c_str(), ssl_config)); |
102 | 102 |
103 int result = ssl_socket_->Connect(&connected_callback_); | 103 int result = ssl_socket_->Connect(&connected_callback_); |
104 | 104 |
105 if (result == net::ERR_IO_PENDING || result == net::OK) { | 105 if (result == net::ERR_IO_PENDING || result == net::OK) { |
106 return 0; | 106 return 0; |
107 } else { | 107 } else { |
108 LOG(ERROR) << "Could not start SSL: " << net::ErrorToString(result); | 108 LOG(ERROR) << "Could not start SSL: " << net::ErrorToString(result); |
(...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
380 } | 380 } |
381 callback->RunWithParams(Tuple1<int>(result)); | 381 callback->RunWithParams(Tuple1<int>(result)); |
382 return true; | 382 return true; |
383 } else { | 383 } else { |
384 LOG(WARNING) << "OnWriteEvent called with no callback."; | 384 LOG(WARNING) << "OnWriteEvent called with no callback."; |
385 return false; | 385 return false; |
386 } | 386 } |
387 } | 387 } |
388 | 388 |
389 } // namespace notifier | 389 } // namespace notifier |
OLD | NEW |