OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2004 The WebRTC Project Authors. All rights reserved. | 2 * Copyright 2004 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 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
120 return socket_->GetError(); | 120 return socket_->GetError(); |
121 } | 121 } |
122 | 122 |
123 void AsyncTCPSocketBase::SetError(int error) { | 123 void AsyncTCPSocketBase::SetError(int error) { |
124 return socket_->SetError(error); | 124 return socket_->SetError(error); |
125 } | 125 } |
126 | 126 |
127 int AsyncTCPSocketBase::SendTo(const void *pv, size_t cb, | 127 int AsyncTCPSocketBase::SendTo(const void *pv, size_t cb, |
128 const SocketAddress& addr, | 128 const SocketAddress& addr, |
129 const rtc::PacketOptions& options) { | 129 const rtc::PacketOptions& options) { |
130 if (addr == GetRemoteAddress()) | 130 const SocketAddress& remote_address = GetRemoteAddress(); |
| 131 if (addr == remote_address) |
131 return Send(pv, cb, options); | 132 return Send(pv, cb, options); |
132 | 133 // Remote address may be empty if there is a sudden network change. |
133 ASSERT(false); | 134 ASSERT(remote_address.IsNil()); |
134 socket_->SetError(ENOTCONN); | 135 socket_->SetError(ENOTCONN); |
135 return -1; | 136 return -1; |
136 } | 137 } |
137 | 138 |
138 int AsyncTCPSocketBase::SendRaw(const void * pv, size_t cb) { | 139 int AsyncTCPSocketBase::SendRaw(const void * pv, size_t cb) { |
139 if (outpos_ + cb > outsize_) { | 140 if (outpos_ + cb > outsize_) { |
140 socket_->SetError(EMSGSIZE); | 141 socket_->SetError(EMSGSIZE); |
141 return -1; | 142 return -1; |
142 } | 143 } |
143 | 144 |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
290 memmove(data, data + kPacketLenSize + pkt_len, *len); | 291 memmove(data, data + kPacketLenSize + pkt_len, *len); |
291 } | 292 } |
292 } | 293 } |
293 } | 294 } |
294 | 295 |
295 void AsyncTCPSocket::HandleIncomingConnection(AsyncSocket* socket) { | 296 void AsyncTCPSocket::HandleIncomingConnection(AsyncSocket* socket) { |
296 SignalNewConnection(this, new AsyncTCPSocket(socket, false)); | 297 SignalNewConnection(this, new AsyncTCPSocket(socket, false)); |
297 } | 298 } |
298 | 299 |
299 } // namespace rtc | 300 } // namespace rtc |
OLD | NEW |