pespin has uploaded this change for review.

View Change

osmo_io: poll: connect_notify: Avoid calling register

osmo_fd used internally should only be registered during
osmo_iofd_register() time, not before.

Change-Id: I8757259edf07a65f19019cf2b2e5886201d31983
---
M src/core/osmo_io_poll.c
1 file changed, 7 insertions(+), 4 deletions(-)

git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/69/39069/1
diff --git a/src/core/osmo_io_poll.c b/src/core/osmo_io_poll.c
index c4bb376..89ff466 100644
--- a/src/core/osmo_io_poll.c
+++ b/src/core/osmo_io_poll.c
@@ -130,10 +130,15 @@

if (IOFD_FLAG_ISSET(iofd, IOFD_FLAG_FD_REGISTERED))
return 0;
+
osmo_fd_setup(ofd, iofd->fd, 0, &iofd_poll_ofd_cb_dispatch, iofd, 0);
+ if (IOFD_FLAG_ISSET(iofd, IOFD_FLAG_NOTIFY_CONNECTED))
+ osmo_fd_write_enable(&iofd->u.poll.ofd);
+
rc = osmo_fd_register(ofd);
if (!rc)
IOFD_FLAG_SET(iofd, IOFD_FLAG_FD_REGISTERED);
+
return rc;
}

@@ -179,11 +184,9 @@

static void iofd_poll_notify_connected(struct osmo_io_fd *iofd)
{
- int rc;
+ /* Set flag to enable during register() time: */
+ IOFD_FLAG_SET(iofd, IOFD_FLAG_NOTIFY_CONNECTED);

- rc = iofd_poll_register(iofd);
- if (rc < 0)
- return;
osmo_fd_write_enable(&iofd->u.poll.ofd);
}


To view, visit change 39069. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-MessageType: newchange
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: I8757259edf07a65f19019cf2b2e5886201d31983
Gerrit-Change-Number: 39069
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <pespin@sysmocom.de>