Index: tools/android/forwarder2/socket.h |
diff --git a/tools/android/forwarder2/socket.h b/tools/android/forwarder2/socket.h |
index b86fd9e7aa67a3e997a04f0d63e8079e11deeb74..33d72fcfedc030eb3fdf13a53918072e8c7704dd 100644 |
--- a/tools/android/forwarder2/socket.h |
+++ b/tools/android/forwarder2/socket.h |
@@ -50,9 +50,17 @@ class Socket { |
// Returns the number of bytes read. |
int Read(void* buffer, size_t buffer_size); |
- // Same as Read(), just a wrapper around write(). |
+ // Non-blocking version of Read() above. This must be called after a |
+ // successful call to select(). The socket must also be in non-blocking mode |
+ // before calling this method. |
+ int NonBlockingRead(void* buffer, size_t buffer_size); |
+ |
+ // Wrapper around send(). |
int Write(const void* buffer, size_t count); |
+ // Same as NonBlockingRead() but for writing. |
+ int NonBlockingWrite(const void* buffer, size_t count); |
+ |
// Calls Read() multiple times until num_bytes is written to the provided |
// buffer. No bounds checking is performed. |
// Returns number of bytes read, which can be different from num_bytes in case |
@@ -105,6 +113,8 @@ class Socket { |
bool was_fired; |
}; |
+ bool SetNonBlocking(); |
+ |
// If |host| is empty, use localhost. |
bool InitTcpSocket(const std::string& host, int port); |
bool InitUnixSocket(const std::string& path); |