Index: base/sync_socket.h |
diff --git a/base/sync_socket.h b/base/sync_socket.h |
index 8ba3f6c2652f0a02e97066dae40f821387b253c3..71addd1e163a9ab16d201a961ba3ae5b3ed6972f 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 or |
+ // |buffer| |length| is exhausted. Currently only timeouts less than one |
+ // second are allowed. Return the amount of data read. |
+ 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 |