diff --git a/src/datagram.c b/src/datagram.c index 8b68244..afae3e7 100644 --- a/src/datagram.c +++ b/src/datagram.c @@ -95,7 +95,7 @@ static int osmo_dgram_tx_write(struct osmo_dgram_tx *conn) LOGP(DLINP, LOGL_DEBUG, "sending data\n"); if (llist_empty(&conn->tx_queue)) { - conn->ofd.when &= ~OSMO_FD_WRITE; + osmo_fd_write_disable(&conn->ofd); return 0; } lh = conn->tx_queue.next; @@ -236,7 +236,7 @@ void osmo_dgram_tx_send(struct osmo_dgram_tx *conn, struct msgb *msg) { msgb_enqueue(&conn->tx_queue, msg); - conn->ofd.when |= OSMO_FD_WRITE; + osmo_fd_write_enable(&conn->ofd); } /* diff --git a/src/rs232.c b/src/rs232.c index 865ec97..b20c111 100644 --- a/src/rs232.c +++ b/src/rs232.c @@ -62,7 +62,7 @@ void rs232_tx_timer_cb(void *ptr) struct osmo_rs232 *r = ptr; /* we're again ready to transmit. */ - r->ofd.when |= OSMO_FD_WRITE; + osmo_fd_write_enable(&r->ofd); } static int handle_ser_write(struct osmo_fd *bfd) @@ -75,7 +75,7 @@ static int handle_ser_write(struct osmo_fd *bfd) LOGP(DLINP, LOGL_DEBUG, "writing data to rs232\n"); if (llist_empty(&r->tx_queue)) { - r->ofd.when &= ~OSMO_FD_WRITE; + osmo_fd_write_disable(&r->ofd); return 0; } lh = r->tx_queue.next; @@ -92,7 +92,7 @@ static int handle_ser_write(struct osmo_fd *bfd) /* We've got more data to write, but we have to wait to make it. */ if (!llist_empty(&r->tx_queue) && r->cfg.delay_us) { - r->ofd.when &= ~OSMO_FD_WRITE; + osmo_fd_write_disable(&r->ofd); osmo_timer_schedule(&r->tx_timer, 0, r->cfg.delay_us); } return 0; @@ -255,7 +255,7 @@ int osmo_rs232_read(struct osmo_rs232 *r, struct msgb *msg) void osmo_rs232_write(struct osmo_rs232 *r, struct msgb *msg) { msgb_enqueue(&r->tx_queue, msg); - r->ofd.when |= OSMO_FD_WRITE; + osmo_fd_write_enable(&r->ofd); } void osmo_rs232_close(struct osmo_rs232 *r) diff --git a/src/stream.c b/src/stream.c index 3376126..e4fb668 100644 --- a/src/stream.c +++ b/src/stream.c @@ -335,7 +335,7 @@ static int osmo_stream_cli_write(struct osmo_stream_cli *cli) int ret; if (llist_empty(&cli->tx_queue)) { - cli->ofd.when &= ~OSMO_FD_WRITE; + osmo_fd_write_disable(&cli->ofd); return 0; } lh = cli->tx_queue.next; @@ -391,7 +391,7 @@ static int osmo_stream_cli_fd_cb(struct osmo_fd *ofd, unsigned int what) /* If messages got enqueued while 'connecting', keep WRITE flag up to dispatch them upon next main loop step */ if (llist_empty(&cli->tx_queue)) - cli->ofd.when &= ~OSMO_FD_WRITE; + osmo_fd_write_disable(&cli->ofd); LOGSCLI(cli, LOGL_DEBUG, "connection done.\n"); cli->state = STREAM_CLI_STATE_CONNECTED; @@ -787,7 +787,7 @@ static void cli_timer_cb(void *data) void osmo_stream_cli_send(struct osmo_stream_cli *cli, struct msgb *msg) { msgb_enqueue(&cli->tx_queue, msg); - cli->ofd.when |= OSMO_FD_WRITE; + osmo_fd_write_enable(&cli->ofd); } /*! \brief Receive data via an Osmocom stream client @@ -1137,7 +1137,7 @@ static void osmo_stream_srv_write(struct osmo_stream_srv *conn) LOGP(DLINP, LOGL_DEBUG, "sending data\n"); if (llist_empty(&conn->tx_queue)) { - conn->ofd.when &= ~OSMO_FD_WRITE; + osmo_fd_write_disable(&conn->ofd); return; } lh = conn->tx_queue.next; @@ -1287,7 +1287,7 @@ void osmo_stream_srv_send(struct osmo_stream_srv *conn, struct msgb *msg) } msgb_enqueue(&conn->tx_queue, msg); - conn->ofd.when |= OSMO_FD_WRITE; + osmo_fd_write_enable(&conn->ofd); } /*! \brief Receive data via Osmocom stream server