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

Side by Side Diff: webrtc/base/asynctcpsocket.cc

Issue 1247573002: Fix a Turn TCP port issue. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc@master
Patch Set: Created 5 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 | « no previous file | webrtc/p2p/base/turnport.h » ('j') | webrtc/p2p/base/turnport.h » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 SocketAddress remote_address = GetRemoteAddress();
131 return Send(pv, cb, options); 131 if (addr != remote_address) {
pthatcher1 2015/07/28 18:23:04 Can you please add a special case for "empty" that
honghaiz3 2015/07/29 21:44:12 Done On 2015/07/28 18:23:04, pthatcher1 wrote:
132 132 LOG(LS_ERROR) << "Destination address " << addr
133 ASSERT(false); 133 << " and socket remote address " << remote_address
134 socket_->SetError(ENOTCONN); 134 << " do not match.";
135 return -1; 135 socket_->SetError(ENOTCONN);
136 return -1;
137 }
138 return Send(pv, cb, options);
136 } 139 }
137 140
138 int AsyncTCPSocketBase::SendRaw(const void * pv, size_t cb) { 141 int AsyncTCPSocketBase::SendRaw(const void * pv, size_t cb) {
139 if (outpos_ + cb > outsize_) { 142 if (outpos_ + cb > outsize_) {
140 socket_->SetError(EMSGSIZE); 143 socket_->SetError(EMSGSIZE);
141 return -1; 144 return -1;
142 } 145 }
143 146
144 memcpy(outbuf_ + outpos_, pv, cb); 147 memcpy(outbuf_ + outpos_, pv, cb);
145 outpos_ += cb; 148 outpos_ += cb;
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
290 memmove(data, data + kPacketLenSize + pkt_len, *len); 293 memmove(data, data + kPacketLenSize + pkt_len, *len);
291 } 294 }
292 } 295 }
293 } 296 }
294 297
295 void AsyncTCPSocket::HandleIncomingConnection(AsyncSocket* socket) { 298 void AsyncTCPSocket::HandleIncomingConnection(AsyncSocket* socket) {
296 SignalNewConnection(this, new AsyncTCPSocket(socket, false)); 299 SignalNewConnection(this, new AsyncTCPSocket(socket, false));
297 } 300 }
298 301
299 } // namespace rtc 302 } // namespace rtc
OLDNEW
« no previous file with comments | « no previous file | webrtc/p2p/base/turnport.h » ('j') | webrtc/p2p/base/turnport.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698