| 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 "jingle/notifier/base/chrome_async_socket.h" | 5 #include "jingle/notifier/base/chrome_async_socket.h" |
| 6 | 6 |
| 7 #if defined(OS_WIN) | 7 #if defined(OS_WIN) |
| 8 #include <winsock2.h> | 8 #include <winsock2.h> |
| 9 #elif defined(OS_POSIX) | 9 #elif defined(OS_POSIX) |
| 10 #include <arpa/inet.h> | 10 #include <arpa/inet.h> |
| (...skipping 419 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 430 read_end_ = 0U; | 430 read_end_ = 0U; |
| 431 DCHECK_EQ(write_end_, 0U); | 431 DCHECK_EQ(write_end_, 0U); |
| 432 | 432 |
| 433 // Clear out any posted DoRead() tasks. | 433 // Clear out any posted DoRead() tasks. |
| 434 scoped_runnable_method_factory_.RevokeAll(); | 434 scoped_runnable_method_factory_.RevokeAll(); |
| 435 | 435 |
| 436 DCHECK(transport_socket_.get()); | 436 DCHECK(transport_socket_.get()); |
| 437 transport_socket_.reset( | 437 transport_socket_.reset( |
| 438 client_socket_factory_->CreateSSLClientSocket( | 438 client_socket_factory_->CreateSSLClientSocket( |
| 439 transport_socket_.release(), net::HostPortPair(domain_name, 443), | 439 transport_socket_.release(), net::HostPortPair(domain_name, 443), |
| 440 ssl_config_, NULL /* ssl_host_info */)); | 440 ssl_config_, NULL /* ssl_host_info */, |
| 441 NULL /* TODO(wtc): cert_verifier */)); |
| 441 int status = transport_socket_->Connect(&ssl_connect_callback_); | 442 int status = transport_socket_->Connect(&ssl_connect_callback_); |
| 442 if (status != net::ERR_IO_PENDING) { | 443 if (status != net::ERR_IO_PENDING) { |
| 443 MessageLoop* message_loop = MessageLoop::current(); | 444 MessageLoop* message_loop = MessageLoop::current(); |
| 444 CHECK(message_loop); | 445 CHECK(message_loop); |
| 445 message_loop->PostTask( | 446 message_loop->PostTask( |
| 446 FROM_HERE, | 447 FROM_HERE, |
| 447 scoped_runnable_method_factory_.NewRunnableMethod( | 448 scoped_runnable_method_factory_.NewRunnableMethod( |
| 448 &ChromeAsyncSocket::ProcessSSLConnectDone, status)); | 449 &ChromeAsyncSocket::ProcessSSLConnectDone, status)); |
| 449 } | 450 } |
| 450 return true; | 451 return true; |
| (...skipping 18 matching lines...) Expand all Loading... |
| 469 } | 470 } |
| 470 state_ = STATE_TLS_OPEN; | 471 state_ = STATE_TLS_OPEN; |
| 471 PostDoRead(); | 472 PostDoRead(); |
| 472 if (write_end_ > 0U) { | 473 if (write_end_ > 0U) { |
| 473 PostDoWrite(); | 474 PostDoWrite(); |
| 474 } | 475 } |
| 475 SignalSSLConnected(); | 476 SignalSSLConnected(); |
| 476 } | 477 } |
| 477 | 478 |
| 478 } // namespace notifier | 479 } // namespace notifier |
| OLD | NEW |