diff mbox series

[1/3] mongoose: gracefully handle broken pipe errors

Message ID 20230130113510.142836-2-daniel@braunwarth.dev
State Accepted
Delegated to: Stefano Babic
Headers show
Series mongoose: gracefully handle broken pipe errors | expand

Commit Message

Daniel Braunwarth Jan. 30, 2023, 11:35 a.m. UTC
In some sporadically appearing cases the IPC file descriptor has already
been closed by the installer while still receiving further data.

In this case the sending client is not receiving any response.

Let's handle this by consuming the remaining data and let the installer
handle the final installation result.

Signed-off-by: Daniel Braunwarth <daniel@braunwarth.dev>
Co-developed-by: Daniel Braunwarth <daniel.braunwarth@kuka.com>
Signed-off-by: Daniel Braunwarth <daniel.braunwarth@kuka.com>
---
 mongoose/mongoose_interface.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/mongoose/mongoose_interface.c b/mongoose/mongoose_interface.c
index 465bd51..a5471cc 100644
--- a/mongoose/mongoose_interface.c
+++ b/mongoose/mongoose_interface.c
@@ -615,7 +615,7 @@  static void upload_handler(struct mg_connection *nc, int ev, void *ev_data,
 			if (written != mp->part.body.len) {
 				if (written < 0) {
 					if (errno != EAGAIN && errno != EWOULDBLOCK) {
-						if ((mp->part.body.len + fus->len) == mp->len) {
+						if (errno == EPIPE || (mp->part.body.len + fus->len) == mp->len) {
 							/*
 							 * Simply consumes the data to unblock the sender
 							 */