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

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

Issue 15008004: Add device port unmapping support to forwarder2. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix typo Created 7 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 side-by-side diff with in-line comments
Download patch
Index: tools/android/forwarder2/socket.h
diff --git a/tools/android/forwarder2/socket.h b/tools/android/forwarder2/socket.h
index 9057f74be9a7365fd51e1b5f3bfaceb316a815bd..7e6b1751c25efdb7098eca7561facb69206b1095 100644
--- a/tools/android/forwarder2/socket.h
+++ b/tools/android/forwarder2/socket.h
@@ -11,6 +11,7 @@
#include <sys/un.h>
#include <string>
+#include <vector>
#include "base/basictypes.h"
@@ -69,19 +70,16 @@ class Socket {
bool has_error() const { return socket_error_; }
- // |exit_notifier_fd| must be a valid pipe file descriptor created from the
+ // |event_fd| must be a valid pipe file descriptor created from the
// PipeNotifier and must live (not be closed) at least as long as this socket
// is alive.
- void set_exit_notifier_fd(int exit_notifier_fd) {
- exit_notifier_fd_ = exit_notifier_fd;
- }
- // Unset the |exit_notifier_fd_| so that it will not receive notifications
- // anymore.
- void reset_exit_notifier_fd() { exit_notifier_fd_ = -1; }
+ void AddEventFd(int event_fd);
// Returns whether Accept() or Connect() was interrupted because the socket
- // received an exit notification.
- bool exited() const { return exited_; }
+ // received an external event fired through the provided fd.
+ bool DidReceiveEventOnFd(int fd) const;
+
+ bool DidReceiveEvent() const { return !fired_events_.empty(); };
static int GetHighestFileDescriptor(const Socket& s1, const Socket& s2);
@@ -130,12 +128,12 @@ class Socket {
// Length of one of the members of the above union depending on the family.
socklen_t addr_len_;
- // File descriptor from PipeNotifier (see pipe_notifier.h) to send application
- // exit notifications before calling socket blocking operations such as Read
- // and Accept.
- int exit_notifier_fd_;
+ // Sorted file descriptors from PipeNotifier (see pipe_notifier.h) to send
+ // application exit notifications before calling socket blocking operations
+ // such as Read and Accept.
+ std::vector<int> event_fds_;
- bool exited_;
+ std::vector<int> fired_events_;
DISALLOW_COPY_AND_ASSIGN(Socket);
};

Powered by Google App Engine
This is Rietveld 408576698