pespin has submitted this change. ( 
https://gerrit.osmocom.org/c/libosmo-netif/+/41666?usp=email )

Change subject: cosmetic: stream_srv: srv_link: Document no need for 
OSMO_SOCK_F_NONBLOCK
......................................................................

cosmetic: stream_srv: srv_link: Document no need for OSMO_SOCK_F_NONBLOCK

osmo_fd_register() currently takes care of setting the socket as
non-blocking, before any blocking call is performed. Document it.

If we ever switch from osmo_fd to io_uring to process the accept() op
then we won't need to set the socket as nonblocking anyway, since
io_uring expects to work with blocking sockets.

Change-Id: I98a6ef55a0a7289b9eeb7e8062e9afa4d87f51eb
---
M src/stream_srv.c
1 file changed, 7 insertions(+), 3 deletions(-)

Approvals:
  osmith: Looks good to me, approved
  Jenkins Builder: Verified
  fixeria: Looks good to me, but someone else must approve




diff --git a/src/stream_srv.c b/src/stream_srv.c
index 6f86cfd..d6d4e2d 100644
--- a/src/stream_srv.c
+++ b/src/stream_srv.c
@@ -571,6 +571,10 @@
 int osmo_stream_srv_link_open(struct osmo_stream_srv_link *link)
 {
        int ret;
+       /* No need to set OSMO_SOCK_F_NONBLOCK since non-blocking behavior is 
only
+        * required later on, during accept() call, and and osmo_fd_register()
+        * below already takes care of setting the socket as non-blocking. */
+       const int sk_flags = OSMO_SOCK_F_BIND;

        if (link->ofd.fd >= 0) {
                /* No reconfigure needed for existing socket, we are fine */
@@ -584,7 +588,7 @@

        switch (link->sk_domain) {
        case AF_UNIX:
-               ret = osmo_sock_unix_init(link->sk_type, 0, link->addr[0], 
OSMO_SOCK_F_BIND);
+               ret = osmo_sock_unix_init(link->sk_type, 0, link->addr[0], 
sk_flags);
                break;
        case AF_UNSPEC:
        case AF_INET:
@@ -594,12 +598,12 @@
                case IPPROTO_SCTP:
                        ret = osmo_sock_init2_multiaddr2(link->sk_domain, 
link->sk_type, link->proto,
                                                         (const char 
**)link->addr, link->addrcnt, link->port,
-                                                        NULL, 0, 0, 
OSMO_SOCK_F_BIND, &link->ma_pars);
+                                                        NULL, 0, 0, sk_flags, 
&link->ma_pars);
                        break;
 #endif
                default:
                        ret = osmo_sock_init(link->sk_domain, link->sk_type, 
link->proto,
-                                            link->addr[0], link->port, 
OSMO_SOCK_F_BIND);
+                                            link->addr[0], link->port, 
sk_flags);
                }
                break;
        default:

--
To view, visit https://gerrit.osmocom.org/c/libosmo-netif/+/41666?usp=email
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings?usp=email

Gerrit-MessageType: merged
Gerrit-Project: libosmo-netif
Gerrit-Branch: master
Gerrit-Change-Id: I98a6ef55a0a7289b9eeb7e8062e9afa4d87f51eb
Gerrit-Change-Number: 41666
Gerrit-PatchSet: 5
Gerrit-Owner: pespin <[email protected]>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: daniel <[email protected]>
Gerrit-Reviewer: fixeria <[email protected]>
Gerrit-Reviewer: jolly <[email protected]>
Gerrit-Reviewer: laforge <[email protected]>
Gerrit-Reviewer: osmith <[email protected]>
Gerrit-Reviewer: pespin <[email protected]>

Reply via email to