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
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;
}