Populate host and port for incoming SSB connections, too.

git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@4457 ed5197a5-7fde-0310-b194-c3ffbd925b24
This commit is contained in:
Cory McWilliams 2023-09-09 14:45:55 +00:00
parent e83e665db9
commit 85ac6c215a

View File

@ -2670,6 +2670,14 @@ static void _tf_ssb_on_connection(uv_stream_t* stream, int status)
return; return;
} }
struct sockaddr_storage addr = { 0 };
int size = sizeof(addr);
if (uv_tcp_getpeername(&connection->tcp, (struct sockaddr*)&addr, &size) == 0)
{
uv_ip_name((struct sockaddr*)&addr, connection->host, sizeof(connection->host));
connection->port = ntohs(((struct sockaddr_in*)&addr)->sin_port);
}
connection->next = ssb->connections; connection->next = ssb->connections;
ssb->connections = connection; ssb->connections = connection;
ssb->connections_count++; ssb->connections_count++;