Use osmo_fd_*_{disable,enable}
Depends: libosmocore.git Idb89ba7bc7c129a6304a76900d17f47daf54d17d Change-Id: I4e228399d21098cc9a99b9cc1aa42b24ec609159
This commit is contained in:
parent
98439edd85
commit
eb77a2971b
|
@ -406,7 +406,7 @@ static int bfd_cb(struct osmo_fd *bfd, unsigned int flags)
|
||||||
if (flags & OSMO_FD_READ)
|
if (flags & OSMO_FD_READ)
|
||||||
return read_response(bfd->fd);
|
return read_response(bfd->fd);
|
||||||
if (flags & OSMO_FD_WRITE) {
|
if (flags & OSMO_FD_WRITE) {
|
||||||
bfd->when &= ~OSMO_FD_WRITE;
|
osmo_fd_write_disable(bfd);
|
||||||
return bcast_find(bfd->fd);
|
return bcast_find(bfd->fd);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -418,7 +418,7 @@ static void timer_cb(void *_data)
|
||||||
{
|
{
|
||||||
struct osmo_fd *bfd = _data;
|
struct osmo_fd *bfd = _data;
|
||||||
|
|
||||||
bfd->when |= OSMO_FD_WRITE;
|
osmo_fd_write_enable(bfd);
|
||||||
|
|
||||||
base_stations_bump(false);
|
base_stations_bump(false);
|
||||||
|
|
||||||
|
|
|
@ -283,7 +283,7 @@ static int handle_udp_read(struct osmo_fd *bfd)
|
||||||
if (other_conn) {
|
if (other_conn) {
|
||||||
/* enqueue the message for TX on the respective FD */
|
/* enqueue the message for TX on the respective FD */
|
||||||
msgb_enqueue(&other_conn->tx_queue, msg);
|
msgb_enqueue(&other_conn->tx_queue, msg);
|
||||||
other_conn->fd.when |= OSMO_FD_WRITE;
|
osmo_fd_write_enable(&other_conn->fd);
|
||||||
} else
|
} else
|
||||||
msgb_free(msg);
|
msgb_free(msg);
|
||||||
|
|
||||||
|
@ -293,7 +293,7 @@ static int handle_udp_read(struct osmo_fd *bfd)
|
||||||
static int handle_udp_write(struct osmo_fd *bfd)
|
static int handle_udp_write(struct osmo_fd *bfd)
|
||||||
{
|
{
|
||||||
/* not implemented yet */
|
/* not implemented yet */
|
||||||
bfd->when &= ~OSMO_FD_WRITE;
|
osmo_fd_write_disable(bfd);
|
||||||
|
|
||||||
return -EIO;
|
return -EIO;
|
||||||
}
|
}
|
||||||
|
@ -840,7 +840,7 @@ static int handle_tcp_read(struct osmo_fd *bfd)
|
||||||
/* enqueue packet towards BSC */
|
/* enqueue packet towards BSC */
|
||||||
msgb_enqueue(&bsc_conn->tx_queue, msg);
|
msgb_enqueue(&bsc_conn->tx_queue, msg);
|
||||||
/* mark respective filedescriptor as 'we want to write' */
|
/* mark respective filedescriptor as 'we want to write' */
|
||||||
bsc_conn->fd.when |= OSMO_FD_WRITE;
|
osmo_fd_write_enable(&bsc_conn->fd);
|
||||||
} else {
|
} else {
|
||||||
logp_ipbc_uid(DLINP, LOGL_INFO, ipbc, bfd->priv_nr >> 8);
|
logp_ipbc_uid(DLINP, LOGL_INFO, ipbc, bfd->priv_nr >> 8);
|
||||||
LOGPC(DLINP, LOGL_INFO, "Dropping packet from %s, "
|
LOGPC(DLINP, LOGL_INFO, "Dropping packet from %s, "
|
||||||
|
@ -869,7 +869,7 @@ static int handle_tcp_write(struct osmo_fd *bfd)
|
||||||
|
|
||||||
/* get the next msg for this timeslot */
|
/* get the next msg for this timeslot */
|
||||||
if (llist_empty(&ipc->tx_queue)) {
|
if (llist_empty(&ipc->tx_queue)) {
|
||||||
bfd->when &= ~OSMO_FD_WRITE;
|
osmo_fd_write_disable(bfd);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
lh = ipc->tx_queue.next;
|
lh = ipc->tx_queue.next;
|
||||||
|
|
|
@ -119,7 +119,7 @@ static int feed_read_cb(struct osmo_fd *ofd)
|
||||||
char buf[256];
|
char buf[256];
|
||||||
|
|
||||||
rc = read(ofd->fd, buf, sizeof(buf));
|
rc = read(ofd->fd, buf, sizeof(buf));
|
||||||
ofd->fd &= ~OSMO_FD_READ;
|
osmo_fd_read_disable(ofd);
|
||||||
|
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
@ -159,7 +159,7 @@ int meas_feed_cfg_set(const char *dst_host, uint16_t dst_port)
|
||||||
if (rc < 0)
|
if (rc < 0)
|
||||||
return rc;
|
return rc;
|
||||||
|
|
||||||
g_mfs.wqueue.bfd.when &= ~OSMO_FD_READ;
|
osmo_fd_read_disable(&g_mfs.wqueue.bfd);
|
||||||
|
|
||||||
if (g_mfs.dst_host)
|
if (g_mfs.dst_host)
|
||||||
talloc_free(g_mfs.dst_host);
|
talloc_free(g_mfs.dst_host);
|
||||||
|
|
|
@ -495,7 +495,7 @@ static int pcu_sock_send(struct gsm_bts *bts, struct msgb *msg)
|
||||||
return -EIO;
|
return -EIO;
|
||||||
}
|
}
|
||||||
msgb_enqueue(&state->upqueue, msg);
|
msgb_enqueue(&state->upqueue, msg);
|
||||||
conn_bfd->when |= OSMO_FD_WRITE;
|
osmo_fd_write_enable(conn_bfd);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -518,7 +518,7 @@ static void pcu_sock_close(struct pcu_sock_state *state)
|
||||||
osmo_fd_unregister(bfd);
|
osmo_fd_unregister(bfd);
|
||||||
|
|
||||||
/* re-enable the generation of ACCEPT for new connections */
|
/* re-enable the generation of ACCEPT for new connections */
|
||||||
state->listen_bfd.when |= OSMO_FD_READ;
|
osmo_fd_read_enable(&state->listen_bfd);
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
/* remove si13, ... */
|
/* remove si13, ... */
|
||||||
|
@ -597,7 +597,7 @@ static int pcu_sock_write(struct osmo_fd *bfd)
|
||||||
msg = llist_entry(state->upqueue.next, struct msgb, list);
|
msg = llist_entry(state->upqueue.next, struct msgb, list);
|
||||||
pcu_prim = (struct gsm_pcu_if *)msg->data;
|
pcu_prim = (struct gsm_pcu_if *)msg->data;
|
||||||
|
|
||||||
bfd->when &= ~OSMO_FD_WRITE;
|
osmo_fd_write_disable(bfd);
|
||||||
|
|
||||||
/* bug hunter 8-): maybe someone forgot msgb_put(...) ? */
|
/* bug hunter 8-): maybe someone forgot msgb_put(...) ? */
|
||||||
if (!msgb_length(msg)) {
|
if (!msgb_length(msg)) {
|
||||||
|
@ -612,7 +612,7 @@ static int pcu_sock_write(struct osmo_fd *bfd)
|
||||||
goto close;
|
goto close;
|
||||||
if (rc < 0) {
|
if (rc < 0) {
|
||||||
if (errno == EAGAIN) {
|
if (errno == EAGAIN) {
|
||||||
bfd->when |= OSMO_FD_WRITE;
|
osmo_fd_write_enable(bfd);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
goto close;
|
goto close;
|
||||||
|
@ -667,7 +667,7 @@ static int pcu_sock_accept(struct osmo_fd *bfd, unsigned int flags)
|
||||||
LOGP(DPCU, LOGL_NOTICE, "PCU connects but we already have "
|
LOGP(DPCU, LOGL_NOTICE, "PCU connects but we already have "
|
||||||
"another active connection ?!?\n");
|
"another active connection ?!?\n");
|
||||||
/* We already have one PCU connected, this is all we support */
|
/* We already have one PCU connected, this is all we support */
|
||||||
state->listen_bfd.when &= ~OSMO_FD_READ;
|
osmo_fd_read_disable(&state->listen_bfd);
|
||||||
close(rc);
|
close(rc);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue