OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2010 The WebRTC Project Authors. All rights reserved. | 2 * Copyright 2010 The WebRTC Project Authors. All rights reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 // | 10 // |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 } | 105 } |
106 } | 106 } |
107 | 107 |
108 // Connect to a remote address. | 108 // Connect to a remote address. |
109 int MacAsyncSocket::Connect(const SocketAddress& addr) { | 109 int MacAsyncSocket::Connect(const SocketAddress& addr) { |
110 // TODO(djw): Consolidate all the connect->resolve->doconnect implementations. | 110 // TODO(djw): Consolidate all the connect->resolve->doconnect implementations. |
111 if (state_ != CS_CLOSED) { | 111 if (state_ != CS_CLOSED) { |
112 SetError(EALREADY); | 112 SetError(EALREADY); |
113 return SOCKET_ERROR; | 113 return SOCKET_ERROR; |
114 } | 114 } |
115 if (addr.IsUnresolved()) { | 115 if (addr.IsUnresolvedIP()) { |
116 LOG(LS_VERBOSE) << "Resolving addr in MacAsyncSocket::Connect"; | 116 LOG(LS_VERBOSE) << "Resolving addr in MacAsyncSocket::Connect"; |
117 resolver_ = new AsyncResolver(); | 117 resolver_ = new AsyncResolver(); |
118 resolver_->SignalWorkDone.connect(this, | 118 resolver_->SignalWorkDone.connect(this, |
119 &MacAsyncSocket::OnResolveResult); | 119 &MacAsyncSocket::OnResolveResult); |
120 resolver_->Start(addr); | 120 resolver_->Start(addr); |
121 state_ = CS_CONNECTING; | 121 state_ = CS_CONNECTING; |
122 return 0; | 122 return 0; |
123 } | 123 } |
124 return DoConnect(addr); | 124 return DoConnect(addr); |
125 } | 125 } |
(...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
468 this_socket->current_callbacks_ &= ~kCFSocketWriteCallBack; | 468 this_socket->current_callbacks_ &= ~kCFSocketWriteCallBack; |
469 this_socket->SignalWriteEvent(this_socket); | 469 this_socket->SignalWriteEvent(this_socket); |
470 break; | 470 break; |
471 | 471 |
472 default: | 472 default: |
473 ASSERT(false && "Invalid callback type for socket"); | 473 ASSERT(false && "Invalid callback type for socket"); |
474 } | 474 } |
475 } | 475 } |
476 | 476 |
477 } // namespace rtc | 477 } // namespace rtc |
OLD | NEW |