mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 961313 - Add the transport protocol to candidate labels. r=abr
This commit is contained in:
parent
45a5a7590a
commit
9f5ebeb6ea
@ -57,17 +57,29 @@ int nr_transport_addr_fmt_addr_string(nr_transport_addr *addr)
|
||||
int _status;
|
||||
/* Max length for normalized IPv6 address string represntation is 39 */
|
||||
char buffer[40];
|
||||
const char *protocol;
|
||||
|
||||
switch(addr->protocol){
|
||||
case IPPROTO_TCP:
|
||||
protocol = "TCP";
|
||||
break;
|
||||
case IPPROTO_UDP:
|
||||
protocol = "UDP";
|
||||
break;
|
||||
default:
|
||||
ABORT(R_INTERNAL);
|
||||
}
|
||||
|
||||
switch(addr->ip_version){
|
||||
case NR_IPV4:
|
||||
if (!inet_ntop(AF_INET, &addr->u.addr4.sin_addr,buffer,sizeof(buffer)))
|
||||
strcpy(buffer, "[error]");
|
||||
snprintf(addr->as_string,sizeof(addr->as_string),"IP4:%s:%d",buffer,ntohs(addr->u.addr4.sin_port));
|
||||
snprintf(addr->as_string,sizeof(addr->as_string),"IP4:%s:%d/%s",buffer,(int)ntohs(addr->u.addr4.sin_port),protocol);
|
||||
break;
|
||||
case NR_IPV6:
|
||||
if (!inet_ntop(AF_INET6, &addr->u.addr6.sin6_addr,buffer,sizeof(buffer)))
|
||||
strcpy(buffer, "[error]");
|
||||
snprintf(addr->as_string,sizeof(addr->as_string),"IP6:[%s]:%d",buffer,ntohs(addr->u.addr6.sin6_port));
|
||||
snprintf(addr->as_string,sizeof(addr->as_string),"IP6:[%s]:%d/%s",buffer,(int)ntohs(addr->u.addr6.sin6_port),protocol);
|
||||
break;
|
||||
default:
|
||||
ABORT(R_INTERNAL);
|
||||
|
@ -67,8 +67,8 @@ typedef struct nr_transport_addr_ {
|
||||
} u;
|
||||
char ifname[MAXIFNAME];
|
||||
/* A string version.
|
||||
52 = 5 ("IP6:[") + 39 (ipv6 address) + 2 ("]:") + 5 (port) + 1 (null) */
|
||||
char as_string[52];
|
||||
56 = 5 ("IP6:[") + 39 (ipv6 address) + 2 ("]:") + 5 (port) + 4 (/UDP) + 1 (null) */
|
||||
char as_string[56];
|
||||
} nr_transport_addr;
|
||||
|
||||
int nr_sockaddr_to_transport_addr(struct sockaddr *saddr, int saddr_len, int protocol, int keep, nr_transport_addr *addr);
|
||||
|
@ -101,7 +101,7 @@ int nr_socket_buffered_stun_create(nr_socket *inner, int max_pending, nr_socket
|
||||
|
||||
sock->inner = inner;
|
||||
|
||||
if ((r=nr_ip4_port_to_transport_addr(INADDR_ANY, 0, NR_IPV4, &sock->remote_addr)))
|
||||
if ((r=nr_ip4_port_to_transport_addr(INADDR_ANY, 0, IPPROTO_UDP, &sock->remote_addr)))
|
||||
ABORT(r);
|
||||
|
||||
/* TODO(ekr@rtfm.com): Check this */
|
||||
@ -146,7 +146,7 @@ int nr_socket_buffered_stun_destroy(void **objp)
|
||||
RFREE(sock->buffer);
|
||||
|
||||
/* Cancel waiting on the socket */
|
||||
if (!nr_socket_getfd(sock->inner, &fd)) {
|
||||
if (sock->inner && !nr_socket_getfd(sock->inner, &fd)) {
|
||||
NR_ASYNC_CANCEL(fd, NR_ASYNC_WAIT_WRITE);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user