fix dtls server example to bind to any when specified

This commit is contained in:
toddouska 2013-01-17 06:51:37 -08:00
parent 1139ad76aa
commit 86c20f0e38

View File

@ -482,12 +482,13 @@ static INLINE int udp_read_connect(SOCKET_T sockfd)
return sockfd;
}
static INLINE void udp_accept(SOCKET_T* sockfd, int* clientfd, func_args* args)
static INLINE void udp_accept(SOCKET_T* sockfd, int* clientfd, int useAnyAddr,
func_args* args)
{
SOCKADDR_IN_T addr;
(void)args;
build_addr(&addr, yasslIP, yasslPort);
build_addr(&addr, (useAnyAddr ? INADDR_ANY : yasslIP), yasslPort);
tcp_socket(sockfd, 1);
@ -523,7 +524,7 @@ static INLINE void tcp_accept(SOCKET_T* sockfd, int* clientfd, func_args* args,
socklen_t client_len = sizeof(client);
if (udp) {
udp_accept(sockfd, clientfd, args);
udp_accept(sockfd, clientfd, useAnyAddr, args);
return;
}