Commit 1cee8a16 authored by Deomid Ryabkov's avatar Deomid Ryabkov Committed by Cesanta Bot

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
parent 57e32b87
......@@ -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);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment