Change in libosmocore[master]: socket: add function to wait until a socket becomes writeable

laforge gerrit-no-reply at lists.osmocom.org
Thu Jun 24 11:03:02 UTC 2021


laforge has posted comments on this change. ( https://gerrit.osmocom.org/c/libosmocore/+/24435 )

Change subject: socket: add function to wait until a socket becomes writeable
......................................................................


Patch Set 7:

Just did a few-lines test program doing nothing but osmo_sock_init2_ofd(.., OSMO_SOCK_F_NONBLOCK|OSMO_SOCK_F_CONNECT); and osmo_select_main().  After the Timeout I get:


poll([{fd=3, events=POLLIN|POLLOUT|POLLERR|POLLHUP}], 1, -1) = 1 ([{fd=3, revents=POLLOUT|POLLERR|POLLHUP}])

That gets translated to OSMO_FD_READ|OSMO_FD_WRITE and the call-back is called.  The only suboptimal part is that OSMO_FD_EXCEPT is not set in such situations.   The current code only sets it if POLLPRI is set.  The current mapping of poll flags to select-style flags is baesd in linux/fs/select.c but we could simply make POLLERR or POLLHUP also set OSMO_FD_EXCEPT if we wanted to.  That way the call-back could call the getsockopt(SO_ERROR) only if that flag is set.


-- 
To view, visit https://gerrit.osmocom.org/c/libosmocore/+/24435
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: I1c68185120fa2a6c9b6cb8aa2a25232a44ff5508
Gerrit-Change-Number: 24435
Gerrit-PatchSet: 7
Gerrit-Owner: dexter <pmaier at sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <vyanitskiy at sysmocom.de>
Gerrit-Reviewer: laforge <laforge at osmocom.org>
Gerrit-Reviewer: pespin <pespin at sysmocom.de>
Gerrit-Comment-Date: Thu, 24 Jun 2021 11:03:02 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: No
Gerrit-MessageType: comment
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20210624/adad30bf/attachment.htm>


More information about the gerrit-log mailing list