osmo_io: Fix write_enable handling in iofd_txqueue

Enable write on first message in both iofd_txqueue_enqueue{,_front}(),
but only if the iofd is not closed.

Change-Id: I75827491bb9fe0c6d1e4a195ac434f049b1a6ba6
This commit is contained in:
Daniel Willmann 2023-06-30 10:52:11 +02:00
parent 181eaa493e
commit e4ecd996d4
1 changed files with 4 additions and 1 deletions

View File

@ -171,7 +171,7 @@ int iofd_txqueue_enqueue(struct osmo_io_fd *iofd, struct iofd_msghdr *msghdr)
llist_add_tail(&msghdr->list, &iofd->tx_queue.msg_queue);
iofd->tx_queue.current_length++;
if (iofd->tx_queue.current_length == 1)
if (iofd->tx_queue.current_length == 1 && !IOFD_FLAG_ISSET(iofd, IOFD_FLAG_CLOSED))
osmo_iofd_ops.write_enable(iofd);
return 0;
@ -188,6 +188,9 @@ void iofd_txqueue_enqueue_front(struct osmo_io_fd *iofd, struct iofd_msghdr *msg
{
llist_add(&msghdr->list, &iofd->tx_queue.msg_queue);
iofd->tx_queue.current_length++;
if (iofd->tx_queue.current_length == 1 && !IOFD_FLAG_ISSET(iofd, IOFD_FLAG_CLOSED))
osmo_iofd_ops.write_enable(iofd);
}
/*! Dequeue a message from the front