daniel has uploaded this change for review.
[WIP] osmo_io: Support detecting connect
libosmo-netif does a non blocking connect() which is signalled by
marking the fd writable.
Therefore osmo_io should signal this somehow. This patch modifies
osmo_iofd_write_enable() so that if called and the write queue is empty
then the write callback will then be called once with msg == NULL and rc == 0.
Change-Id: I893cbc3becd5e125f2f06b3654578aed0aacadf3
---
M src/core/osmo_io.c
M src/core/osmo_io_poll.c
2 files changed, 23 insertions(+), 2 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/59/32759/1
diff --git a/src/core/osmo_io.c b/src/core/osmo_io.c
index b52b838..e783de8 100644
--- a/src/core/osmo_io.c
+++ b/src/core/osmo_io.c
@@ -392,8 +392,7 @@
void osmo_iofd_write_enable(struct osmo_io_fd *iofd)
{
iofd->write_enabled = true;
- if (iofd->tx_queue.current_length > 0)
- osmo_iofd_ops.write_enable(iofd);
+ osmo_iofd_ops.write_enable(iofd);
}
/*! Disable writing to this iofd
diff --git a/src/core/osmo_io_poll.c b/src/core/osmo_io_poll.c
index bc203c0..b368c7a 100644
--- a/src/core/osmo_io_poll.c
+++ b/src/core/osmo_io_poll.c
@@ -110,7 +110,13 @@
talloc_free(msghdr);
msgb_free(msg);
+ } else {
+ if (iofd->mode == OSMO_IO_FD_MODE_READ_WRITE)
+ iofd->io_ops.write_cb(iofd, 0, NULL);
+ if (osmo_iofd_txqueue_len(iofd) == 0)
+ iofd_poll_ops.write_disable(iofd);
}
+
}
}
To view, visit change 32759. To unsubscribe, or for help writing mail filters, visit settings.