[common] Add support for ClientSocket on Linux (#97)

Uses the abstractions written for ServerSocket in ClientSocket, so
that it builds on Linux. Also adds a method to poll for connections
and uses that in cdc_rsync. Similar code will be used in cdc_fuse_fs
to wait for a connection in a future CL.
This commit is contained in:
Lutz Justen
2023-05-27 21:18:13 +02:00
committed by GitHub
parent 26ff93489e
commit 678ee0ffaf
6 changed files with 185 additions and 143 deletions
+4
View File
@@ -29,6 +29,10 @@ class ClientSocket : public Socket {
ClientSocket();
~ClientSocket();
// Polls until a connection to |port| succeeds.
// Returns TimeoutError
static absl::Status WaitForConnection(int port, absl::Duration timeout);
// Connects to localhost on |port|.
absl::Status Connect(int port);