aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--openbsc/include/openbsc/control_cmd.h3
-rw-r--r--openbsc/src/libctrl/control_if.c5
2 files changed, 7 insertions, 1 deletions
diff --git a/openbsc/include/openbsc/control_cmd.h b/openbsc/include/openbsc/control_cmd.h
index 725dce06..8aede15d 100644
--- a/openbsc/include/openbsc/control_cmd.h
+++ b/openbsc/include/openbsc/control_cmd.h
@@ -39,6 +39,9 @@ struct ctrl_connection {
/* The queue for sending data back */
struct osmo_wqueue write_queue;
+ /* Buffer for partial input data */
+ struct msgb *pending_msg;
+
/* Callback if the connection was closed */
void (*closed_cb)(struct ctrl_connection *conn);
diff --git a/openbsc/src/libctrl/control_if.c b/openbsc/src/libctrl/control_if.c
index 2727d0dd..ca59d8c6 100644
--- a/openbsc/src/libctrl/control_if.c
+++ b/openbsc/src/libctrl/control_if.c
@@ -123,6 +123,7 @@ static void control_close_conn(struct ctrl_connection *ccon)
llist_del(&ccon->list_entry);
if (ccon->closed_cb)
ccon->closed_cb(ccon);
+ msgb_free(ccon->pending_msg);
talloc_free(ccon);
}
@@ -140,8 +141,10 @@ static int handle_control_read(struct osmo_fd * bfd)
queue = container_of(bfd, struct osmo_wqueue, bfd);
ccon = container_of(queue, struct ctrl_connection, write_queue);
- ret = ipa_msg_recv(bfd->fd, &msg);
+ ret = ipa_msg_recv_buffered(bfd->fd, &msg, &ccon->pending_msg);
if (ret <= 0) {
+ if (ret == -EAGAIN)
+ return 0;
if (ret == 0)
LOGP(DCTRL, LOGL_INFO, "The control connection was closed\n");
else