Change in libosmocore[master]: ctrl: Support recovering from short write

pespin gerrit-no-reply at lists.osmocom.org
Tue Jun 15 16:29:45 UTC 2021


pespin has submitted this change. ( https://gerrit.osmocom.org/c/libosmocore/+/24640 )

Change subject: ctrl: Support recovering from short write
......................................................................

ctrl: Support recovering from short write

osmo_wqueue has support for it, so simply handle it correctly in the
callback (updating buffer and returning -EAGAIN).

Related: OS#5169
Change-Id: I6cbc7ec6ae6832e61cddf4402332ba09b142a7d4
---
M src/ctrl/control_if.c
1 file changed, 7 insertions(+), 1 deletion(-)

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

Objections:
  fixeria: I would prefer this is not merged as is



diff --git a/src/ctrl/control_if.c b/src/ctrl/control_if.c
index d117fcf..0a893ba 100644
--- a/src/ctrl/control_if.c
+++ b/src/ctrl/control_if.c
@@ -489,8 +489,14 @@
 		control_close_conn(ccon);
 		return -EBADF;
 	}
-	if (rc != msg->len)
+	if (rc < 0) {
 		LOGP(DLCTRL, LOGL_ERROR, "Failed to write message to the CTRL connection.\n");
+		return 0;
+	}
+	if (rc < msg->len) {
+		msgb_pull(msg, rc);
+		return -EAGAIN;
+	}
 
 	return 0;
 }

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

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: I6cbc7ec6ae6832e61cddf4402332ba09b142a7d4
Gerrit-Change-Number: 24640
Gerrit-PatchSet: 2
Gerrit-Owner: pespin <pespin 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-CC: neels <nhofmeyr at sysmocom.de>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20210615/527f791b/attachment.htm>


More information about the gerrit-log mailing list