mirror of
https://github.com/cesanta/mongoose.git
synced 2026-12-03 21:48:22 +00:00
Fix mg_socket_if_get_conn_addr for UDP sockets
Remote address is not associated with an outgoing UDP socket. Instead, it is stored in mg_connection.sa PUBLISHED_FROM=16f82ee8a69b995d684ec96b8db6b5591cd400db
This commit is contained in:
1 parent
57e32b87c7
commit
1cee8a16b9
1 file changed
+4
@@ -3792,6 +3792,10 @@ void mg_sock_to_str(sock_t sock, char *buf, size_t len, int flags) {
|
||||
|
||||
void mg_socket_if_get_conn_addr(struct mg_connection *nc, int remote,
|
||||
union socket_address *sa) {
|
||||
if ((nc->flags & MG_F_UDP) && remote) {
|
||||
memcpy(sa, &nc->sa, sizeof(*sa));
|
||||
return;
|
||||
}
|
||||
mg_sock_get_addr(nc->sock, remote, sa);
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user