pespin has submitted this change. ( 
https://gerrit.osmocom.org/c/libosmocore/+/39348?usp=email )

Change subject: osmo_io: Improve osmo_iofd_notify_connected() documentation
......................................................................

osmo_io: Improve osmo_iofd_notify_connected() documentation

The mentioned scenario happens when using osmo_stream_cli inside
libosmo-abis BTS code connecting to an osmo-bsc in the loopback
interface.
The client sends SYN and the server sends SYN+ACK and then quickly sends
an IPA ID GET.

Change-Id: Ica20a050b98d117995a5b625b23ab9faa61aabee
(cherry picked from commit 59753c57a5d084549b43e63e3f0a0f6b4d21d766)
---
M src/core/osmo_io.c
1 file changed, 12 insertions(+), 2 deletions(-)

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




diff --git a/src/core/osmo_io.c b/src/core/osmo_io.c
index 98d8ef3..9c93e25 100644
--- a/src/core/osmo_io.c
+++ b/src/core/osmo_io.c
@@ -994,12 +994,22 @@

 /*! Request notification of the user if/when a client socket is connected.
  *  Calling this function will request osmo_io to notify the user (via
- *  write call-back) once a non-blocking outbound connect() of the
- *  socket completes.
+ *  write call-back with res=0 and msgb=NULL) once a non-blocking outbound
+ *  connect() of the socket completes.
  *
  *  This only works for connection oriented sockets in either
  *  OSMO_IO_FD_MODE_READ_WRITE or OSMO_IO_FD_MODE_RECVMSG_SENDMSG mode.
  *
+ * The fact that the write call-back is called with msgb=NULL can be used to
+ * distinguish before this "connected" notification and a socket write failure.
+ *
+ * If the server transmits data quick enough after accepting the connection,
+ * it may happen that a read call-back is triggered towards the user before 
this
+ * special write-callback, since both events may come together from the kernel.
+ * Hence under those scenarios where server starts the communication, it is
+ * important not to assume or require that the write-callback(res=0, msgb=NULL)
+ * will be the first one triggered.
+ *
  *  \param[in] iofd the file descriptor */
 void osmo_iofd_notify_connected(struct osmo_io_fd *iofd)
 {

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

Gerrit-MessageType: merged
Gerrit-Project: libosmocore
Gerrit-Branch: pespin/rel-1.10.0
Gerrit-Change-Id: Ica20a050b98d117995a5b625b23ab9faa61aabee
Gerrit-Change-Number: 39348
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <[email protected]>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: neels <[email protected]>
Gerrit-Reviewer: osmith <[email protected]>
Gerrit-Reviewer: pespin <[email protected]>

Reply via email to