summaryrefslogtreecommitdiffstats
path: root/src/host/virt_phy
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2017-07-13 16:37:27 +0200
committerHarald Welte <laforge@gnumonks.org>2017-07-13 16:37:27 +0200
commitc4324da7c6f684689b6c2343fc817f96c98419b8 (patch)
tree0c4bc641807b0424b1b0a852a74fb73832c0c4a4 /src/host/virt_phy
parent4f9913f1fd3702c8e5af0e1afab0ada9bad3e522 (diff)
VIRT-PHY: Use osmo_fd_close() introduced in libosmocore
libosmocore has recently received a new function osmo_fd_close() which can be used to replace the private fd_close() function in this code. This requires Change-Id Icd0933eed6a24edde7cdcb378e138897ecc5332c in libosmocore. Change-Id: Id8a518dfb09465c2765681407e5581aee2d62d6d
Diffstat (limited to 'src/host/virt_phy')
-rw-r--r--src/host/virt_phy/src/shared/osmo_mcast_sock.c19
1 files changed, 4 insertions, 15 deletions
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 0521c0dd..b52e0057 100644
--- a/src/host/virt_phy/src/shared/osmo_mcast_sock.c
+++ b/src/host/virt_phy/src/shared/osmo_mcast_sock.c
@@ -10,17 +10,6 @@
#include <unistd.h>
#include <virtphy/osmo_mcast_sock.h>
-/* convenience wrapper */
-static void fd_close(struct osmo_fd *ofd)
-{
- /* multicast memberships of socket are implicitly dropped when
- * socket is closed */
- osmo_fd_unregister(ofd);
- close(ofd->fd);
- ofd->fd = -1;
- ofd->when = 0;
-}
-
/* server socket is what we use for transmission. It is not subscribed
* to a multicast group or locally bound, but it is just a normal UDP
* socket that's connected to the remote mcast group + port */
@@ -69,7 +58,7 @@ int mcast_client_sock_setup(struct osmo_fd *ofd, const char *mcast_group, uint16
rc = osmo_sock_mcast_subscribe(ofd->fd, mcast_group);
if (rc < 0) {
perror("Failed to join to mcast goup");
- fd_close(ofd);
+ osmo_fd_close(ofd);
return rc;
}
@@ -96,7 +85,7 @@ mcast_bidir_sock_setup(void *ctx, const char *tx_mcast_group, uint16_t tx_mcast_
}
rc = mcast_server_sock_setup(&bidir_sock->tx_ofd, tx_mcast_group, tx_mcast_port, loopback);
if (rc < 0) {
- fd_close(&bidir_sock->rx_ofd);
+ osmo_fd_close(&bidir_sock->rx_ofd);
talloc_free(bidir_sock);
return NULL;
}
@@ -117,7 +106,7 @@ int mcast_bidir_sock_rx(struct mcast_bidir_sock *bidir_sock, uint8_t *buf, unsig
void mcast_bidir_sock_close(struct mcast_bidir_sock *bidir_sock)
{
- fd_close(&bidir_sock->tx_ofd);
- fd_close(&bidir_sock->rx_ofd);
+ osmo_fd_close(&bidir_sock->tx_ofd);
+ osmo_fd_close(&bidir_sock->rx_ofd);
talloc_free(bidir_sock);
}