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

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

Issue 1944683002: Read recv timestamps from socket (posix only). (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: rebase 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 420 matching lines...) Expand 10 before | Expand all | Expand 10 after
431 sockaddr_storage saddr; 431 sockaddr_storage saddr;
432 size_t addr_len = addr.ToSockAddrStorage(&saddr); 432 size_t addr_len = addr.ToSockAddrStorage(&saddr);
433 int sent = ::sendto(socket_, reinterpret_cast<const char*>(buffer), 433 int sent = ::sendto(socket_, reinterpret_cast<const char*>(buffer),
434 static_cast<int>(length), 0, 434 static_cast<int>(length), 0,
435 reinterpret_cast<sockaddr*>(&saddr), 435 reinterpret_cast<sockaddr*>(&saddr),
436 static_cast<int>(addr_len)); 436 static_cast<int>(addr_len));
437 UpdateLastError(); 437 UpdateLastError();
438 return sent; 438 return sent;
439 } 439 }
440 440
441 int Win32Socket::Recv(void* buffer, size_t length) { 441 int Win32Socket::Recv(void* buffer, size_t length, int64_t* timestamp) {
442 if (timestamp) {
443 *timestamp = -1;
444 }
442 int received = ::recv(socket_, static_cast<char*>(buffer), 445 int received = ::recv(socket_, static_cast<char*>(buffer),
443 static_cast<int>(length), 0); 446 static_cast<int>(length), 0);
444 UpdateLastError(); 447 UpdateLastError();
445 if (closing_ && received <= static_cast<int>(length)) 448 if (closing_ && received <= static_cast<int>(length))
446 PostClosed(); 449 PostClosed();
447 return received; 450 return received;
448 } 451 }
449 452
450 int Win32Socket::RecvFrom(void* buffer, size_t length, 453 int Win32Socket::RecvFrom(void* buffer,
451 SocketAddress* out_addr) { 454 size_t length,
455 SocketAddress* out_addr,
456 int64_t* timestamp) {
457 if (timestamp) {
458 *timestamp = -1;
459 }
452 sockaddr_storage saddr; 460 sockaddr_storage saddr;
453 socklen_t addr_len = sizeof(saddr); 461 socklen_t addr_len = sizeof(saddr);
454 int received = ::recvfrom(socket_, static_cast<char*>(buffer), 462 int received = ::recvfrom(socket_, static_cast<char*>(buffer),
455 static_cast<int>(length), 0, 463 static_cast<int>(length), 0,
456 reinterpret_cast<sockaddr*>(&saddr), &addr_len); 464 reinterpret_cast<sockaddr*>(&saddr), &addr_len);
457 UpdateLastError(); 465 UpdateLastError();
458 if (received != SOCKET_ERROR) 466 if (received != SOCKET_ERROR)
459 SocketAddressFromSockAddrStorage(saddr, out_addr); 467 SocketAddressFromSockAddrStorage(saddr, out_addr);
460 if (closing_ && received <= static_cast<int>(length)) 468 if (closing_ && received <= static_cast<int>(length))
461 PostClosed(); 469 PostClosed();
(...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after
845 bool handled = false; 853 bool handled = false;
846 if (wm == s_wm_wakeup_id || (wm == WM_TIMER && wp == 1)) { 854 if (wm == s_wm_wakeup_id || (wm == WM_TIMER && wp == 1)) {
847 ss_->Pump(); 855 ss_->Pump();
848 lr = 0; 856 lr = 0;
849 handled = true; 857 handled = true;
850 } 858 }
851 return handled; 859 return handled;
852 } 860 }
853 861
854 } // namespace rtc 862 } // namespace rtc
OLDNEW
« no previous file with comments | « webrtc/base/win32socketserver.h ('k') | webrtc/examples/peerconnection/client/peer_connection_client.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698