diff options
Diffstat (limited to 'hicn-light/src/hicn/io')
-rw-r--r-- | hicn-light/src/hicn/io/base.c | 5 | ||||
-rw-r--r-- | hicn-light/src/hicn/io/tcp.c | 4 | ||||
-rw-r--r-- | hicn-light/src/hicn/io/udp.c | 15 |
3 files changed, 10 insertions, 14 deletions
diff --git a/hicn-light/src/hicn/io/base.c b/hicn-light/src/hicn/io/base.c index 35d8915a8..bd5904ccb 100644 --- a/hicn-light/src/hicn/io/base.c +++ b/hicn-light/src/hicn/io/base.c @@ -115,11 +115,16 @@ ssize_t io_read_batch_socket(int fd, msgbuf_t ** msgbuf, } /* Assign size to msgbuf, and build address pair */ + // TODO: local (in pair) is not initialized for (int i = 0; i < n; i++) { struct mmsghdr *msg = &msghdr[i]; msgbuf[i]->length = msg->msg_hdr.msg_iovlen; **address = *(address_t*)msg->msg_hdr.msg_name; + + struct sockaddr_in *src = msghdr[i].msg_hdr.msg_name; + DEBUG("msg received from port %u", ntohs(src->sin_port)); } + break; } return n; diff --git a/hicn-light/src/hicn/io/tcp.c b/hicn-light/src/hicn/io/tcp.c index e4e2b06af..e4f5d196f 100644 --- a/hicn-light/src/hicn/io/tcp.c +++ b/hicn-light/src/hicn/io/tcp.c @@ -391,14 +391,14 @@ connection_tcp_read_message(connection_t * connection, msgbuf_t * msgbuf) size_t n = evbuffer_get_length(data->evbuffer); // XXX this check was wrong - // parcAssertTrue(n >= sizeof(header_control_message), + // parcAssertTrue(n >= sizeof(cmd_header_t), "Called with too short an input: %zu", n); // XXX WTF if (stream->next_len == 0) { // this linearizes the first messageHandler_GetIPv6HeaderLength() bytes of the // input buffer's iovecs and returns a pointer to it. - uint8_t *fh = parcEventBuffer_Pullup(data->evbuffer, sizeof(header_control_message)); + uint8_t *fh = parcEventBuffer_Pullup(data->evbuffer, sizeof(cmd_header_t)); // Calculate the total message size based on the fixed header stream->next_len = messageHandler_GetTotalPacketLength(fh); diff --git a/hicn-light/src/hicn/io/udp.c b/hicn-light/src/hicn/io/udp.c index 38d643838..edff902de 100644 --- a/hicn-light/src/hicn/io/udp.c +++ b/hicn-light/src/hicn/io/udp.c @@ -215,15 +215,6 @@ listener_udp_initialize(listener_t * listener) listener_udp_data_t * data = listener->data; assert(data); #endif - - // XXX Socket creation should be a function per-se and not be called in - // initialize ! - listener->fd = listener_get_socket(listener, &listener->address, NULL, - listener->interface_name); - if (listener->fd < 0) { - ERROR("Error creating UDP socket: (%d) %s", errno, strerror(errno)); - return -1; - } return 0; } @@ -249,7 +240,7 @@ int listener_udp_get_socket(const listener_t * listener, const address_t * local, const address_t * remote, const char * interface_name) { - int fd = socket(address_family(remote), SOCK_DGRAM, 0); + int fd = socket(address_family(local), SOCK_DGRAM, 0); if (fd < 0) goto ERR_SOCKET; @@ -257,7 +248,7 @@ listener_udp_get_socket(const listener_t * listener, const address_t * local, goto ERR; } - if (bind(fd, address_sa(local), address_socklen(remote)) < 0) { + if (bind(fd, address_sa(local), address_socklen(local)) < 0) { perror("bind"); goto ERR; } @@ -313,7 +304,7 @@ connection_udp_initialize(connection_t * connection) { assert(connection); - assert(connection->type == FACE_TYPE_UDP); + assert(connection->type == FACE_TYPE_UDP || connection->type == FACE_TYPE_UDP_LISTENER); assert(connection->interface_name); connection_udp_data_t * data = connection->data; |