| 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);
|
| };
|
|
|