Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Fixes in source.c #1

Merged
merged 1 commit into from

2 participants

@skinkie
Collaborator
  • source socket is now closed after an unsuccesful address family approach
  • we are now using the correct structure to set the destination port (v4/v6)
  • we are using the src->addr_current for updating the socket

(and I want to be a member tooooo!)

@skinkie skinkie Fixes:
 - source socket is now closed after an unsuccesful address family approach
 - we are now using the correct structure to set the destination port (v4/v6)
 - we are using the src->addr_current for updating the socket
84e068b
@alobbs

There is no much of a point for this. It will reach this point if it could not create the socket fd, and therefore there is nothing to be closed. (It does not hurt though).

@alobbs alobbs merged commit 51d2fb5 into cherokee:master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Oct 13, 2011
  1. @skinkie

    Fixes:

    skinkie authored
     - source socket is now closed after an unsuccesful address family approach
     - we are now using the correct structure to set the destination port (v4/v6)
     - we are using the src->addr_current for updating the socket
This page is out of date. Refresh to see the latest.
Showing with 14 additions and 2 deletions.
  1. +14 −2 cherokee/source.c
View
16 cherokee/source.c
@@ -161,13 +161,25 @@ cherokee_source_connect (cherokee_source_t *src, cherokee_socket_t *sock)
addr = addr_info;
continue;
}
+
+ cherokee_socket_close(sock);
}
/* Update the new socket with the address info
*/
- SOCKET_ADDR_IPv4(sock)->sin_port = htons(src->port);
+ switch (src->addr_current->ai_family) {
+ case AF_INET:
+ SOCKET_ADDR_IPv4(sock)->sin_port = htons(src->port);
+ break;
+ case AF_INET6:
+ SOCKET_ADDR_IPv6(sock)->sin6_port = htons(src->port);
+ break;
+ default:
+ SHOULDNT_HAPPEN;
+ return ret_error;
+ }
- ret = cherokee_socket_update_from_addrinfo (sock, addr_info, 0);
+ ret = cherokee_socket_update_from_addrinfo (sock, src->addr_current, 0);
if (unlikely (ret != ret_ok)) {
return ret_error;
}
Something went wrong with that request. Please try again.