mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-24 01:31:46 +00:00
StartClient(): Make a local copy of server_name.
Previously we just held onto the const char* provided by the user. This does not work in cases such as Java which provide a temporary string.
This commit is contained in:
@@ -26,8 +26,11 @@ void Dispatcher::StartServer(StringRef persist_filename,
|
||||
}
|
||||
|
||||
void Dispatcher::StartClient(const char* server_name, unsigned int port) {
|
||||
DispatcherBase::StartClient(std::bind(&TCPConnector::connect, server_name,
|
||||
static_cast<int>(port), 1));
|
||||
std::string server_name_copy(server_name);
|
||||
DispatcherBase::StartClient([=]() -> std::unique_ptr<NetworkStream> {
|
||||
return TCPConnector::connect(server_name_copy.c_str(),
|
||||
static_cast<int>(port), 1);
|
||||
});
|
||||
}
|
||||
|
||||
Dispatcher::Dispatcher()
|
||||
|
||||
Reference in New Issue
Block a user