Change in osmo-pcap[master]: client: Ensure the "file" header is sent on connect

laforge gerrit-no-reply at lists.osmocom.org
Sat Apr 24 08:42:17 UTC 2021


laforge has submitted this change. ( https://gerrit.osmocom.org/c/osmo-pcap/+/23874 )

Change subject: client: Ensure the "file" header is sent on connect
......................................................................

client: Ensure the "file" header is sent on connect

A non-blocking STREAM socket connect() will mark the socket as
write-able once the connection succeeds.  However, as we first
call osmo_fd_setup() and then osmo_sock_init2_ofd(), the latter
will force the 'when' to OSMO_FD_READ and hence the write callback
will not be called.

Change-Id: I44c484b48966a985a9b85fb16122a17df5666bc1
---
M src/osmo_client_network.c
1 file changed, 4 insertions(+), 4 deletions(-)

Approvals:
  Jenkins Builder: Verified
  pespin: Looks good to me, approved



diff --git a/src/osmo_client_network.c b/src/osmo_client_network.c
index c6de579..e5616af 100644
--- a/src/osmo_client_network.c
+++ b/src/osmo_client_network.c
@@ -293,10 +293,8 @@
 		break;
 	}
 
-	osmo_fd_setup(&conn->wqueue.bfd, -1, when, conn_cb, conn, 0);
-	rc = osmo_sock_init2_ofd(&conn->wqueue.bfd, AF_INET, sock_type, sock_proto,
-				conn->source_ip, 0, conn->srv_ip, srv_port,
-				OSMO_SOCK_F_BIND | OSMO_SOCK_F_CONNECT | OSMO_SOCK_F_NONBLOCK);
+	rc = osmo_sock_init2(AF_INET, sock_type, sock_proto, conn->source_ip, 0, conn->srv_ip, srv_port,
+			     OSMO_SOCK_F_BIND | OSMO_SOCK_F_CONNECT | OSMO_SOCK_F_NONBLOCK);
 	if (rc < 0) {
 		LOGP(DCLIENT, LOGL_ERROR,
 		     "Failed to connect conn=%s to %s:%d\n",
@@ -304,6 +302,8 @@
 		lost_connection(conn);
 		return;
 	}
+	osmo_fd_setup(&conn->wqueue.bfd, rc, when, conn_cb, conn, 0);
+	osmo_fd_register(&conn->wqueue.bfd);
 
 	rate_ctr_inc(&conn->client->ctrg->ctr[CLIENT_CTR_CONNECT]);
 }

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

Gerrit-Project: osmo-pcap
Gerrit-Branch: master
Gerrit-Change-Id: I44c484b48966a985a9b85fb16122a17df5666bc1
Gerrit-Change-Number: 23874
Gerrit-PatchSet: 2
Gerrit-Owner: laforge <laforge at osmocom.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge at osmocom.org>
Gerrit-Reviewer: pespin <pespin at sysmocom.de>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20210424/1b0baa53/attachment.htm>


More information about the gerrit-log mailing list