diff options
author | Harald Welte <laforge@gnumonks.org> | 2017-07-13 13:49:37 +0200 |
---|---|---|
committer | Harald Welte <laforge@gnumonks.org> | 2017-07-13 13:49:37 +0200 |
commit | a2f06f28e286013dcbdd15a29b32a8b80a068e0c (patch) | |
tree | d8d4e29154882f36427815cb0fd751c604c802b0 /src/host/virt_phy | |
parent | 46a452412600c37deea5df4568c9bb03c9e7b48d (diff) |
VIRT-PHY: osmo_mcast_sock: Get rid of server_sock.sock_conf
We don't need to store this data, we cans simply connect the socket to
the destination mcast address instead.
Change-Id: I3c98653c41eff9feb649d9c47cd40b26fd81ed05
Diffstat (limited to 'src/host/virt_phy')
-rw-r--r-- | src/host/virt_phy/include/virtphy/osmo_mcast_sock.h | 1 | ||||
-rw-r--r-- | src/host/virt_phy/src/shared/osmo_mcast_sock.c | 10 |
2 files changed, 1 insertions, 10 deletions
diff --git a/src/host/virt_phy/include/virtphy/osmo_mcast_sock.h b/src/host/virt_phy/include/virtphy/osmo_mcast_sock.h index f318ffea..abf2c48d 100644 --- a/src/host/virt_phy/include/virtphy/osmo_mcast_sock.h +++ b/src/host/virt_phy/include/virtphy/osmo_mcast_sock.h @@ -5,7 +5,6 @@ struct mcast_server_sock { struct osmo_fd *osmo_fd; - struct sockaddr_in *sock_conf; }; struct mcast_client_sock { diff --git a/src/host/virt_phy/src/shared/osmo_mcast_sock.c b/src/host/virt_phy/src/shared/osmo_mcast_sock.c index b9bf90c3..fdbbb885 100644 --- a/src/host/virt_phy/src/shared/osmo_mcast_sock.c +++ b/src/host/virt_phy/src/shared/osmo_mcast_sock.c @@ -21,7 +21,6 @@ mcast_server_sock_setup(void *ctx, char* tx_mcast_group, int tx_mcast_port, int /* TODO: why allocate those dynamically ?!? */ serv_sock->osmo_fd = talloc_zero(serv_sock, struct osmo_fd); - serv_sock->sock_conf = talloc_zero(serv_sock, struct sockaddr_in); /* setup mcast server socket */ rc = osmo_sock_init_ofd(serv_sock->osmo_fd, AF_INET, SOCK_DGRAM, IPPROTO_UDP, @@ -31,11 +30,6 @@ mcast_server_sock_setup(void *ctx, char* tx_mcast_group, int tx_mcast_port, int return NULL; } - /* TODO: Why kleep this stored in sock_conf? */ - serv_sock->sock_conf->sin_family = AF_INET; - serv_sock->sock_conf->sin_addr.s_addr = inet_addr(tx_mcast_group); - serv_sock->sock_conf->sin_port = htons(tx_mcast_port); - /* determines whether sent mcast packets should be looped back to the local sockets. * loopback must be enabled if the mcast client is on the same machine */ if (setsockopt(serv_sock->osmo_fd->fd, IPPROTO_IP, IP_MULTICAST_LOOP, @@ -131,8 +125,7 @@ int mcast_client_sock_rx(struct mcast_client_sock *client_sock, void* buf, int mcast_server_sock_tx(struct mcast_server_sock *serv_sock, void* data, int data_len) { - return sendto(serv_sock->osmo_fd->fd, data, data_len, 0, - (struct sockaddr *)serv_sock->sock_conf, sizeof(*serv_sock->sock_conf)); + return send(serv_sock->osmo_fd->fd, data, data_len, 0); } int mcast_bidir_sock_tx(struct mcast_bidir_sock *bidir_sock, void* data, @@ -162,7 +155,6 @@ void mcast_client_sock_close(struct mcast_client_sock *client_sock) void mcast_server_sock_close(struct mcast_server_sock *serv_sock) { close(serv_sock->osmo_fd->fd); - talloc_free(serv_sock->sock_conf); talloc_free(serv_sock); } |