network: fix known UDP ports bind regression

introduced by b4e5af6346
Add driving strikers netdemo known port
Issue #1112
This commit is contained in:
Flyinghead 2023-06-21 16:31:01 +02:00
parent dca048981f
commit 0070f9abad
1 changed files with 6 additions and 12 deletions

View File

@ -232,6 +232,10 @@ static GamePortList GamesPorts[] = {
{ },
{ 17219 },
},
{ // Driving Strikers online demo
{ "IND-161053" },
{ 30099 },
},
{ // Atomiswave
{ "FASTER THAN SPEED" },
@ -1078,18 +1082,8 @@ static void *pico_thread_func(void *)
for (u32 i = 0; i < std::size(ports->udpPorts) && ports->udpPorts[i] != 0; i++)
{
uint16_t port = short_be(ports->udpPorts[i]);
sock_t sockfd = find_udp_socket(port);
saddr.sin_port = port;
if (::bind(sockfd, (sockaddr *)&saddr, saddr_len) < 0)
{
perror("bind");
closesocket(sockfd);
auto it = udp_sockets.find(port);
if (it != udp_sockets.end())
it->second = INVALID_SOCKET;
continue;
}
find_udp_socket(port);
// bind is done in find_udp_socket
}
for (u32 i = 0; i < std::size(ports->tcpPorts) && ports->tcpPorts[i] != 0; i++)