From b8b1f1ba80ce4afdb603131888a8040e55742f9c Mon Sep 17 00:00:00 2001 From: Cory McWilliams Date: Thu, 29 Jun 2023 00:17:32 +0000 Subject: [PATCH] Confused by this message. Add more context. git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@4334 ed5197a5-7fde-0310-b194-c3ffbd925b24 --- src/ssb.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/ssb.c b/src/ssb.c index e3cb5401..73fd6ea0 100644 --- a/src/ssb.c +++ b/src/ssb.c @@ -2628,10 +2628,14 @@ static void _tf_ssb_send_broadcast(tf_ssb_t* ssb, struct sockaddr_in* address, s { struct sockaddr server_addr; int len = (int)sizeof(server_addr); - if (uv_tcp_getsockname(&ssb->server, &server_addr, &len) != 0 || - server_addr.sa_family != AF_INET) + int r = uv_tcp_getsockname(&ssb->server, &server_addr, &len); + 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]; @@ -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 = (address->sin_addr.s_addr & 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) { char broadcast_str[256] = { 0 };