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

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

pespin gerrit-no-reply at lists.osmocom.org
Thu Jun 10 12:50:46 UTC 2021


pespin has uploaded this change for review. ( 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(-)



  git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/40/24640/1

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: 1
Gerrit-Owner: pespin <pespin at sysmocom.de>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20210610/660bb9ce/attachment.htm>


More information about the gerrit-log mailing list