| CODENOTIFIER | HelpYou are not signed inSign in |
Project: Libevent
Revision: 946
Author: nprovos
Date: 15 Nov 2008 00:27:23
Changes:only bind the socket on connect when a local address has been provided; reported by Ajejo Sanchez
Files:| ... | ...@@ -126,6 +126,7 @@ | |
| 126 | 126 | o Add new utility functions to correctly observe and log winsock errors. |
| 127 | 127 | o Do not remove Accept-Encoding header |
| 128 | 128 | o Clear the timer cache on entering the event loop; reported by Victor Chang |
| 129 | o Only bind the socket on connect when a local address has been provided; reported by Alejo Sanchez | |
| 129 | 130 | |
| 130 | 131 | Changes in 1.4.0: |
| 131 | 132 | o allow \r or \n individually to separate HTTP headers instead of the standard "\r\n"; from Charles Kerr. |
| ... | ...@@ -2846,8 +2846,8 @@ | |
| 2846 | 2846 | *pport = mm_strdup(strport); |
| 2847 | 2847 | } |
| 2848 | 2848 | |
| 2849 | /* Either connect or bind */ | |
| 2850 | ||
| 2849 | /* Create a non-blocking socket and bind it */ | |
| 2850 | /* todo: rename this function */ | |
| 2851 | 2851 | static evutil_socket_t |
| 2852 | 2852 | bind_socket_ai(struct addrinfo *ai, int reuse) |
| 2853 | 2853 | { |
| ... | ...@@ -2879,9 +2879,11 @@ | |
| 2879 | 2879 | (void *)&on, sizeof(on)); |
| 2880 | 2880 | } |
| 2881 | 2881 | |
| 2882 | r = bind(fd, ai->ai_addr, ai->ai_addrlen); | |
| 2883 | if (r == -1) | |
| 2884 | goto out; | |
| 2882 | if (ai != NULL) { | |
| 2883 | r = bind(fd, ai->ai_addr, ai->ai_addrlen); | |
| 2884 | if (r == -1) | |
| 2885 | goto out; | |
| 2886 | } | |
| 2885 | 2887 | |
| 2886 | 2888 | return (fd); |
| 2887 | 2889 | |
| ... | ...@@ -2934,7 +2936,13 @@ | |
| 2934 | 2936 | bind_socket(const char *address, ev_uint16_t port, int reuse) |
| 2935 | 2937 | { |
| 2936 | 2938 | evutil_socket_t fd; |
| 2937 | struct addrinfo *aitop = make_addrinfo(address, port); | |
| 2939 | struct addrinfo *aitop = NULL; | |
| 2940 | ||
| 2941 | /* just create an unbound socket */ | |
| 2942 | if (address == NULL && port == 0) | |
| 2943 | return bind_socket_ai(NULL, 0); | |
| 2944 | ||
| 2945 | aitop = make_addrinfo(address, port); | |
| 2938 | 2946 | |
| 2939 | 2947 | if (aitop == NULL) |
| 2940 | 2948 | return (-1); |