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

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

Issue 10382003: Changes needed to roll libjingle r141 (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: Created 8 years, 7 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 | Annotate | Revision Log
OLDNEW
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 "jingle/notifier/base/chrome_async_socket.h" 5 #include "jingle/notifier/base/chrome_async_socket.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <cstring> 8 #include <cstring>
9 #include <cstdlib> 9 #include <cstdlib>
10 10
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 } 84 }
85 85
86 // STATE_CLOSED -> STATE_CONNECTING 86 // STATE_CLOSED -> STATE_CONNECTING
87 87
88 bool ChromeAsyncSocket::Connect(const talk_base::SocketAddress& address) { 88 bool ChromeAsyncSocket::Connect(const talk_base::SocketAddress& address) {
89 if (state_ != STATE_CLOSED) { 89 if (state_ != STATE_CLOSED) {
90 LOG(DFATAL) << "Connect() called on non-closed socket"; 90 LOG(DFATAL) << "Connect() called on non-closed socket";
91 DoNonNetError(ERROR_WRONGSTATE); 91 DoNonNetError(ERROR_WRONGSTATE);
92 return false; 92 return false;
93 } 93 }
94 // We can't work with an empty hostname and IP address. 94 // We can't work with an empty hostname and IP address.
akalin 2012/05/11 18:13:02 "hostname and IP address." -> "hostname. We don't
Mallinath (Gone from Chromium) 2012/05/11 20:52:45 Done.
95 if (address.hostname().empty() && (address.ip() == 0)) { 95 if (address.hostname().empty() && (address.ip() == 0)) {
akalin 2012/05/11 18:13:02 remove the check for ip()
Mallinath (Gone from Chromium) 2012/05/11 20:52:45 Done.
96 DoNonNetError(ERROR_DNS); 96 DoNonNetError(ERROR_DNS);
97 return false; 97 return false;
98 } 98 }
99 99
100 DCHECK_EQ(state_, buzz::AsyncSocket::STATE_CLOSED); 100 DCHECK_EQ(state_, buzz::AsyncSocket::STATE_CLOSED);
101 DCHECK_EQ(read_state_, IDLE); 101 DCHECK_EQ(read_state_, IDLE);
102 DCHECK_EQ(write_state_, IDLE); 102 DCHECK_EQ(write_state_, IDLE);
103 103
104 state_ = STATE_CONNECTING; 104 state_ = STATE_CONNECTING;
105 105
106 DCHECK_EQ(false, weak_factory_.HasWeakPtrs()); 106 DCHECK_EQ(false, weak_factory_.HasWeakPtrs());
107 107
108 net::HostPortPair dest_host_port_pair(address.IPAsString(), address.port()); 108 net::HostPortPair dest_host_port_pair((address.hostname().empty() ?
akalin 2012/05/11 18:04:05 this should actually be: ... dest_host_port_pair(
Mallinath (Gone from Chromium) 2012/05/11 18:10:40 What should happen if hostname is empty? As talk_b
akalin 2012/05/11 18:13:02 Actually, this doesn't look like it was a bug befo
Mallinath (Gone from Chromium) 2012/05/11 20:52:45 Done.
109 address.ipaddr().ToString() : address.hostname()), address.port());
109 110
110 transport_socket_.reset( 111 transport_socket_.reset(
111 client_socket_factory_->CreateTransportClientSocket( 112 client_socket_factory_->CreateTransportClientSocket(
112 dest_host_port_pair)); 113 dest_host_port_pair));
113 int status = transport_socket_->Connect( 114 int status = transport_socket_->Connect(
114 base::Bind(&ChromeAsyncSocket::ProcessConnectDone, 115 base::Bind(&ChromeAsyncSocket::ProcessConnectDone,
115 base::Unretained(this))); 116 base::Unretained(this)));
116 if (status != net::ERR_IO_PENDING) { 117 if (status != net::ERR_IO_PENDING) {
117 // We defer execution of ProcessConnectDone instead of calling it 118 // We defer execution of ProcessConnectDone instead of calling it
118 // directly here as the caller may not expect an error/close to 119 // directly here as the caller may not expect an error/close to
(...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after
437 } 438 }
438 state_ = STATE_TLS_OPEN; 439 state_ = STATE_TLS_OPEN;
439 PostDoRead(); 440 PostDoRead();
440 if (write_end_ > 0U) { 441 if (write_end_ > 0U) {
441 PostDoWrite(); 442 PostDoWrite();
442 } 443 }
443 SignalSSLConnected(); 444 SignalSSLConnected();
444 } 445 }
445 446
446 } // namespace notifier 447 } // namespace notifier
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698