Fix handshake when running client and server on same PC

This commit is contained in:
Patrick Nicolas
2023-12-20 23:22:33 +01:00
parent c9c88ea39e
commit 714895104c
+8 -6
View File
@@ -56,8 +56,6 @@ void wivrn_session::handshake()
continue;
if (std::holds_alternative<to_headset::handshake>(*packet))
{
// If this packet is lost, a tracking packet will do the job to establish the connection
send_stream(from_headset::handshake{});
return;
}
@@ -71,21 +69,25 @@ void wivrn_session::handshake()
wivrn_session::wivrn_session(in6_addr address, int port) :
control(address, port), stream(), address(address)
{
stream.connect(address, port);
stream.set_receive_buffer_size(1024 * 1024 * 5);
char buffer[100];
spdlog::info("Connection to {}:{}", inet_ntop(AF_INET6, &address, buffer, sizeof(buffer)), port);
handshake();
stream.connect(address, port);
stream.set_receive_buffer_size(1024 * 1024 * 5);
// If this packet is lost, a tracking packet will do the job to establish the connection
send_stream(from_headset::handshake{});
}
wivrn_session::wivrn_session(in_addr address, int port) :
control(address, port), stream(), address(address)
{
stream.connect(address, port);
stream.set_receive_buffer_size(1024 * 1024 * 5);
char buffer[100];
spdlog::info("Connection to {}:{}", inet_ntop(AF_INET, &address, buffer, sizeof(buffer)), port);
handshake();
stream.connect(address, port);
stream.set_receive_buffer_size(1024 * 1024 * 5);
// If this packet is lost, a tracking packet will do the job to establish the connection
send_stream(from_headset::handshake{});
}