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

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

Issue 1944683002: Read recv timestamps from socket (posix only). (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Fix win build. Created 4 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
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 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 Destroy(); 122 Destroy();
123 } 123 }
124 124
125 void ProxyBinding::Read(AsyncSocket* socket, FifoBuffer* buffer) { 125 void ProxyBinding::Read(AsyncSocket* socket, FifoBuffer* buffer) {
126 // Only read if the buffer is empty. 126 // Only read if the buffer is empty.
127 ASSERT(socket != NULL); 127 ASSERT(socket != NULL);
128 size_t size; 128 size_t size;
129 int read; 129 int read;
130 if (buffer->GetBuffered(&size) && size == 0) { 130 if (buffer->GetBuffered(&size) && size == 0) {
131 void* p = buffer->GetWriteBuffer(&size); 131 void* p = buffer->GetWriteBuffer(&size);
132 read = socket->Recv(p, size); 132 int64_t timestamp;
133 read = socket->Recv(p, size, &timestamp);
133 buffer->ConsumeWriteBuffer(std::max(read, 0)); 134 buffer->ConsumeWriteBuffer(std::max(read, 0));
134 } 135 }
135 } 136 }
136 137
137 void ProxyBinding::Write(AsyncSocket* socket, FifoBuffer* buffer) { 138 void ProxyBinding::Write(AsyncSocket* socket, FifoBuffer* buffer) {
138 ASSERT(socket != NULL); 139 ASSERT(socket != NULL);
139 size_t size; 140 size_t size;
140 int written; 141 int written;
141 const void* p = buffer->GetReadData(&size); 142 const void* p = buffer->GetReadData(&size);
142 written = socket->Send(p, size); 143 written = socket->Send(p, size);
143 buffer->ConsumeReadData(std::max(written, 0)); 144 buffer->ConsumeReadData(std::max(written, 0));
144 } 145 }
145 146
146 void ProxyBinding::Destroy() { 147 void ProxyBinding::Destroy() {
147 SignalDestroyed(this); 148 SignalDestroyed(this);
148 } 149 }
149 150
150 AsyncProxyServerSocket* SocksProxyServer::WrapSocket(AsyncSocket* socket) { 151 AsyncProxyServerSocket* SocksProxyServer::WrapSocket(AsyncSocket* socket) {
151 return new AsyncSocksProxyServerSocket(socket); 152 return new AsyncSocksProxyServerSocket(socket);
152 } 153 }
153 154
154 } // namespace rtc 155 } // namespace rtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698