Confused by this message. Add more context.

git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@4334 ed5197a5-7fde-0310-b194-c3ffbd925b24
This commit is contained in:
Cory McWilliams 2023-06-29 00:17:32 +00:00
parent caf7478da4
commit b8b1f1ba80

View File

@ -2628,10 +2628,14 @@ static void _tf_ssb_send_broadcast(tf_ssb_t* ssb, struct sockaddr_in* address, s
{ {
struct sockaddr server_addr; struct sockaddr server_addr;
int len = (int)sizeof(server_addr); int len = (int)sizeof(server_addr);
if (uv_tcp_getsockname(&ssb->server, &server_addr, &len) != 0 || int r = uv_tcp_getsockname(&ssb->server, &server_addr, &len);
server_addr.sa_family != AF_INET) if (r != 0)
{ {
tf_printf("Unable to get server's address.\n"); tf_printf("Unable to get server's address: %s.\n", uv_strerror(r));
}
else if (server_addr.sa_family != AF_INET)
{
tf_printf("Unexpected address family: %d\n", server_addr.sa_family);
} }
char address_str[256]; char address_str[256];
@ -2654,7 +2658,7 @@ static void _tf_ssb_send_broadcast(tf_ssb_t* ssb, struct sockaddr_in* address, s
broadcast_addr.sin_addr.s_addr = broadcast_addr.sin_addr.s_addr =
(address->sin_addr.s_addr & netmask->sin_addr.s_addr) | (address->sin_addr.s_addr & netmask->sin_addr.s_addr) |
(INADDR_BROADCAST & ~netmask->sin_addr.s_addr); (INADDR_BROADCAST & ~netmask->sin_addr.s_addr);
int r = uv_udp_try_send(&ssb->broadcast_sender, &buf, 1, (struct sockaddr*)&broadcast_addr); r = uv_udp_try_send(&ssb->broadcast_sender, &buf, 1, (struct sockaddr*)&broadcast_addr);
if (r < 0) if (r < 0)
{ {
char broadcast_str[256] = { 0 }; char broadcast_str[256] = { 0 };