Skip to content
This repository
Browse code

Merge branch 'master' of github.com:cherokee/webserver

  • Loading branch information...
commit 7fa0399200131999d1c3c2855675f2195e121504 2 parents d3fc95d + 51d2fb5
Alvaro Lopez Ortega authored October 16, 2011

Showing 1 changed file with 14 additions and 2 deletions. Show diff stats Hide diff stats

  1. 16  cherokee/source.c
16  cherokee/source.c
@@ -161,13 +161,25 @@ cherokee_source_connect (cherokee_source_t *src, cherokee_socket_t *sock)
161 161
 				addr = addr_info;
162 162
 				continue;
163 163
 			}
  164
+
  165
+			cherokee_socket_close(sock);
164 166
 		}
165 167
 
166 168
 		/* Update the new socket with the address info
167 169
 		 */
168  
-		SOCKET_ADDR_IPv4(sock)->sin_port = htons(src->port);
  170
+		switch (src->addr_current->ai_family) {
  171
+		case AF_INET:
  172
+			SOCKET_ADDR_IPv4(sock)->sin_port = htons(src->port);
  173
+			break;
  174
+		case AF_INET6:
  175
+			SOCKET_ADDR_IPv6(sock)->sin6_port = htons(src->port);
  176
+			break;
  177
+		default:
  178
+			SHOULDNT_HAPPEN;
  179
+			return ret_error;
  180
+		}
169 181
 
170  
-		ret = cherokee_socket_update_from_addrinfo (sock, addr_info, 0);
  182
+		ret = cherokee_socket_update_from_addrinfo (sock, src->addr_current, 0);
171 183
 		if (unlikely (ret != ret_ok)) {
172 184
 			return ret_error;
173 185
 		}

0 notes on commit 7fa0399

Please sign in to comment.
Something went wrong with that request. Please try again.