Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(79)

Side by Side Diff: jingle/notifier/base/chrome_async_socket.cc

Issue 3174004: Pass both hostname and port into SSLClientSocket (Closed)
Patch Set: Created 10 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « chrome/browser/net/preconnect.cc ('k') | jingle/notifier/communicator/ssl_socket_adapter.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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>
11 #endif 11 #endif
12 12
13 #include <algorithm> 13 #include <algorithm>
14 #include <cstring> 14 #include <cstring>
15 #include <cstdlib> 15 #include <cstdlib>
16 16
17 #include "base/compiler_specific.h" 17 #include "base/compiler_specific.h"
18 #include "base/logging.h" 18 #include "base/logging.h"
19 #include "net/base/address_list.h" 19 #include "net/base/address_list.h"
20 #include "net/base/host_port_pair.h"
20 #include "net/base/io_buffer.h" 21 #include "net/base/io_buffer.h"
21 #include "net/base/ssl_config_service.h" 22 #include "net/base/ssl_config_service.h"
22 #include "net/base/sys_addrinfo.h" 23 #include "net/base/sys_addrinfo.h"
23 #include "net/socket/client_socket_factory.h" 24 #include "net/socket/client_socket_factory.h"
24 #include "net/socket/ssl_client_socket.h" 25 #include "net/socket/ssl_client_socket.h"
25 #include "net/socket/tcp_client_socket.h" 26 #include "net/socket/tcp_client_socket.h"
26 #include "talk/base/socketaddress.h" 27 #include "talk/base/socketaddress.h"
27 28
28 namespace notifier { 29 namespace notifier {
29 30
(...skipping 399 matching lines...) Expand 10 before | Expand all | Expand 10 after
429 state_ = STATE_TLS_CONNECTING; 430 state_ = STATE_TLS_CONNECTING;
430 read_state_ = IDLE; 431 read_state_ = IDLE;
431 read_start_ = 0U; 432 read_start_ = 0U;
432 read_end_ = 0U; 433 read_end_ = 0U;
433 DCHECK_EQ(write_end_, 0U); 434 DCHECK_EQ(write_end_, 0U);
434 435
435 // Clear out any posted DoRead() tasks. 436 // Clear out any posted DoRead() tasks.
436 scoped_runnable_method_factory_.RevokeAll(); 437 scoped_runnable_method_factory_.RevokeAll();
437 438
438 DCHECK(transport_socket_.get()); 439 DCHECK(transport_socket_.get());
440 // This is not passed the port explictly, but transport_socket_ is a
441 // TCP socket, so GetPeerAddress will not have proxy issues.
442 net::AddressList address;
443 transport_socket_->GetPeerAddress(&address);
444 net::HostPortPair endpoint(domain_name, address.GetPort());
439 transport_socket_.reset( 445 transport_socket_.reset(
440 client_socket_factory_->CreateSSLClientSocket( 446 client_socket_factory_->CreateSSLClientSocket(
441 transport_socket_.release(), domain_name, ssl_config_)); 447 transport_socket_.release(), endpoint, ssl_config_));
442 int status = transport_socket_->Connect(&ssl_connect_callback_); 448 int status = transport_socket_->Connect(&ssl_connect_callback_);
443 if (status != net::ERR_IO_PENDING) { 449 if (status != net::ERR_IO_PENDING) {
444 MessageLoop* message_loop = MessageLoop::current(); 450 MessageLoop* message_loop = MessageLoop::current();
445 CHECK(message_loop); 451 CHECK(message_loop);
446 message_loop->PostTask( 452 message_loop->PostTask(
447 FROM_HERE, 453 FROM_HERE,
448 scoped_runnable_method_factory_.NewRunnableMethod( 454 scoped_runnable_method_factory_.NewRunnableMethod(
449 &ChromeAsyncSocket::ProcessSSLConnectDone, status)); 455 &ChromeAsyncSocket::ProcessSSLConnectDone, status));
450 } 456 }
451 return true; 457 return true;
(...skipping 18 matching lines...) Expand all
470 } 476 }
471 state_ = STATE_TLS_OPEN; 477 state_ = STATE_TLS_OPEN;
472 PostDoRead(); 478 PostDoRead();
473 if (write_end_ > 0U) { 479 if (write_end_ > 0U) {
474 PostDoWrite(); 480 PostDoWrite();
475 } 481 }
476 SignalSSLConnected(); 482 SignalSSLConnected();
477 } 483 }
478 484
479 } // namespace notifier 485 } // namespace notifier
OLDNEW
« no previous file with comments | « chrome/browser/net/preconnect.cc ('k') | jingle/notifier/communicator/ssl_socket_adapter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698