mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-23 01:21:42 +00:00
TCPConnector: Add method to connect to server in parallel. (#6)
This substantially speeds up connection times compared to sequentially trying to connect to each server in round-robin fashion.
This commit is contained in:
@@ -26,6 +26,7 @@
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include "llvm/ArrayRef.h"
|
||||
#include "tcpsockets/NetworkStream.h"
|
||||
|
||||
namespace wpi {
|
||||
@@ -37,6 +38,9 @@ class TCPConnector {
|
||||
static std::unique_ptr<NetworkStream> connect(const char* server, int port,
|
||||
Logger& logger,
|
||||
int timeout = 0);
|
||||
static std::unique_ptr<NetworkStream> connect_parallel(
|
||||
llvm::ArrayRef<std::pair<const char*, int>> servers, Logger& logger,
|
||||
int timeout = 0);
|
||||
};
|
||||
|
||||
} // namespace wpi
|
||||
|
||||
Reference in New Issue
Block a user