| CODENOTIFIER | HelpYou are not signed inSign in |
Project: Libevent
Revision: 947
Author: nprovos
Date: 15 Nov 2008 00:29:39
Changes:from trunk: only bind the socket on connect when a local address has been provided; reported by Ajejo Sanchez
Files:| ... | ...@@ -2626,8 +2626,8 @@ | |
| 2626 | 2626 | *pport = strdup(strport); |
| 2627 | 2627 | } |
| 2628 | 2628 | |
| 2629 | /* Either connect or bind */ | |
| 2630 | ||
| 2629 | /* Create a non-blocking socket and bind it */ | |
| 2630 | /* todo: rename this function */ | |
| 2631 | 2631 | static int |
| 2632 | 2632 | bind_socket_ai(struct addrinfo *ai, int reuse) |
| 2633 | 2633 | { |
| ... | ...@@ -2657,9 +2657,11 @@ | |
| 2657 | 2657 | (void *)&on, sizeof(on)); |
| 2658 | 2658 | } |
| 2659 | 2659 | |
| 2660 | r = bind(fd, ai->ai_addr, ai->ai_addrlen); | |
| 2661 | if (r == -1) | |
| 2662 | goto out; | |
| 2660 | if (ai != NULL) { | |
| 2661 | r = bind(fd, ai->ai_addr, ai->ai_addrlen); | |
| 2662 | if (r == -1) | |
| 2663 | goto out; | |
| 2664 | } | |
| 2663 | 2665 | |
| 2664 | 2666 | return (fd); |
| 2665 | 2667 | |
| ... | ...@@ -2712,7 +2714,13 @@ | |
| 2712 | 2714 | bind_socket(const char *address, u_short port, int reuse) |
| 2713 | 2715 | { |
| 2714 | 2716 | int fd; |
| 2715 | struct addrinfo *aitop = make_addrinfo(address, port); | |
| 2717 | struct addrinfo *aitop = NULL; | |
| 2718 | ||
| 2719 | /* just create an unbound socket */ | |
| 2720 | if (address == NULL && port == 0) | |
| 2721 | return bind_socket_ai(NULL, 0); | |
| 2722 | ||
| 2723 | aitop = make_addrinfo(address, port); | |
| 2716 | 2724 | |
| 2717 | 2725 | if (aitop == NULL) |
| 2718 | 2726 | return (-1); |
| ... | ...@@ -1,6 +1,7 @@ | |
| 1 | 1 | Changes in 1.4.9-stable: |
| 2 | 2 | o event_add would not return error for some backends; from Dean McNamee |
| 3 | 3 | o Clear the timer cache on entering the event loop; reported by Victor Chang |
| 4 | o Only bind the socket on connect when a local address has been provided; reported by Alejo Sanchez | |
| 4 | 5 | |
| 5 | 6 | Changes in 1.4.8-stable: |
| 6 | 7 | o Match the query in DNS replies to the query in the request; from Vsevolod Stakhov. |