Index: base/sync_socket.h |
diff --git a/base/sync_socket.h b/base/sync_socket.h |
index 8ba3f6c2652f0a02e97066dae40f821387b253c3..29da75f5382d942fe669b28ef2a327e48c181597 100644 |
--- a/base/sync_socket.h |
+++ b/base/sync_socket.h |
@@ -18,6 +18,7 @@ |
#include "base/base_export.h" |
#include "base/compiler_specific.h" |
#include "base/synchronization/waitable_event.h" |
+#include "base/time/time.h" |
namespace base { |
@@ -58,6 +59,13 @@ class BASE_EXPORT SyncSocket { |
// Returns the number of bytes received, or 0 upon failure. |
virtual size_t Receive(void* buffer, size_t length); |
+ // Same as Receive() but only blocks for data until |timeout| has elapsed. |
jar (doing other things)
2013/10/14 15:31:07
nit: "... or |buffer| |length| is exhausted."
DaleCurtis
2013/10/14 19:25:13
Done.
|
+ // Currently only timeouts less than one second are allowed. Timeouts will |
+ // return the amount of data read prior to timeout. |
jar (doing other things)
2013/10/14 15:31:07
nit: Remove leading words "Timeout will" and trail
DaleCurtis
2013/10/14 19:25:13
Done.
|
+ virtual size_t ReceiveWithTimeout(void* buffer, |
+ size_t length, |
+ TimeDelta timeout); |
+ |
// Returns the number of bytes available. If non-zero, Receive() will not |
// not block when called. NOTE: Some implementations cannot reliably |
// determine the number of bytes available so avoid using the returned |
@@ -102,6 +110,9 @@ class BASE_EXPORT CancelableSyncSocket : public SyncSocket { |
// SyncSocket methods in order to support shutting down the 'socket'. |
virtual bool Close() OVERRIDE; |
virtual size_t Receive(void* buffer, size_t length) OVERRIDE; |
+ virtual size_t ReceiveWithTimeout(void* buffer, |
+ size_t length, |
+ TimeDelta timeout) OVERRIDE; |
#endif |
// Send() is overridden to catch cases where the remote end is not responding |