y_socket: debug addrlen need to be set correctly, here sizeof sockaddr_storage for all!
This commit is contained in:
@@ -32,7 +32,7 @@ int y_NODE_T_cmp(y_NODE_T nodeA, y_NODE_T nodeB){
|
|||||||
int ret=0;
|
int ret=0;
|
||||||
|
|
||||||
//ret = nodeA.addr_len - nodeB.addr_len;
|
//ret = nodeA.addr_len - nodeB.addr_len;
|
||||||
if(ret == 0){
|
//if(ret == 0){
|
||||||
|
|
||||||
printf("debug: ++++++++++++ lenA=%d, lenB=%d\n", nodeA.addr_len , nodeB.addr_len);
|
printf("debug: ++++++++++++ lenA=%d, lenB=%d\n", nodeA.addr_len , nodeB.addr_len);
|
||||||
ret = nodeA.addr.ss_family - nodeB.addr.ss_family;
|
ret = nodeA.addr.ss_family - nodeB.addr.ss_family;
|
||||||
@@ -54,7 +54,7 @@ int y_NODE_T_cmp(y_NODE_T nodeA, y_NODE_T nodeB){
|
|||||||
ret = memcmp(((struct sockaddr_in6*)&(nodeA.addr))->sin6_addr.s6_addr , ((struct sockaddr_in6*)&(nodeB.addr))->sin6_addr.s6_addr, 8);
|
ret = memcmp(((struct sockaddr_in6*)&(nodeA.addr))->sin6_addr.s6_addr , ((struct sockaddr_in6*)&(nodeB.addr))->sin6_addr.s6_addr, 8);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
//}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -426,8 +426,8 @@ void *y_socket_poll_fds(void *arg){
|
|||||||
// I had to initialize all attribute of addr to avoid error uninitialized value with valgrind, for example "sin6_flowinfo" in sockaddr_in6
|
// I had to initialize all attribute of addr to avoid error uninitialized value with valgrind, for example "sin6_flowinfo" in sockaddr_in6
|
||||||
memset(&(node.addr), 0, sizeof(struct sockaddr_storage));
|
memset(&(node.addr), 0, sizeof(struct sockaddr_storage));
|
||||||
//size_t len_sockaddr_storage = sizeof(struct sockaddr_storage);
|
//size_t len_sockaddr_storage = sizeof(struct sockaddr_storage);
|
||||||
//node.addr_len = len_sockaddr_storage; // sizeof(struct sockaddr_storage);
|
node.addr_len = sizeof(struct sockaddr_storage);
|
||||||
node.addr_len = 0;/* init here to be sure it will have the appropriate value */
|
//node.addr_len = 0;/* init here to be sure it will have the appropriate value */
|
||||||
// printf("debug: ------ //// node.addr_len = %d\n",node.addr_len);
|
// printf("debug: ------ //// node.addr_len = %d\n",node.addr_len);
|
||||||
for(;check_y_socket_go_on(argSock);){
|
for(;check_y_socket_go_on(argSock);){
|
||||||
printf("poll: wait events\n");
|
printf("poll: wait events\n");
|
||||||
|
|||||||
Reference in New Issue
Block a user