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

Unified Diff: tools/android/forwarder2/socket.h

Issue 68893013: Fix socket usage in forwarder2. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 1 month 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | tools/android/forwarder2/socket.cc » ('j') | tools/android/forwarder2/socket.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
« no previous file with comments | « no previous file | tools/android/forwarder2/socket.cc » ('j') | tools/android/forwarder2/socket.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698