mirror of
https://github.com/cesanta/mongoose.git
synced 2025-06-12 20:59:03 +08: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:
parent
57e32b87c7
commit
1cee8a16b9
@ -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,
|
void mg_socket_if_get_conn_addr(struct mg_connection *nc, int remote,
|
||||||
union socket_address *sa) {
|
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);
|
mg_sock_get_addr(nc->sock, remote, sa);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user