aboutsummaryrefslogtreecommitdiffstats
path: root/hicn-light/src/hicn/io/udp.c
diff options
context:
space:
mode:
Diffstat (limited to 'hicn-light/src/hicn/io/udp.c')
-rw-r--r--hicn-light/src/hicn/io/udp.c15
1 files changed, 3 insertions, 12 deletions
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;