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/.
Max gerrit-no-reply at lists.osmocom.orgMax has uploaded this change for review. ( https://gerrit.osmocom.org/11912 Change subject: ctrl: handle ECONNRESET on initial read gracefully ...................................................................... ctrl: handle ECONNRESET on initial read gracefully When we're reading CTRL header we might get ECONNRESET when previous message was successfully sent and the peer have already closed connection. This is not really an error (for example script requesting single variable have closed the connection right after reading our answer) so just just discard the message and carry on. Change-Id: I3cbdb3909660d605181d6923031336d296ea4340 --- M src/gsm/ipa.c 1 file changed, 9 insertions(+), 3 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/12/11912/1 diff --git a/src/gsm/ipa.c b/src/gsm/ipa.c index 6ee003d..82ca304 100644 --- a/src/gsm/ipa.c +++ b/src/gsm/ipa.c @@ -548,7 +548,7 @@ * \param[in] needed Home many bytes we have to read. * \returns boolean indicating whether message should be discarded. */ -static inline bool recv_discard_msg(int *ret, int fd, struct msgb *msg, int needed) +static inline bool recv_discard_msg(int *ret, int fd, struct msgb *msg, int needed, bool initial) { *ret = recv(fd, msg->tail, needed, 0); @@ -563,6 +563,12 @@ return false; } + if (errno == ECONNRESET && initial && needed == 3) { + /* that's initial attempt to read IPA header while connection is already closed */ + *ret = 0; + return true; + } + /* errors indicated by -1 return value, let's save the actual error code */ *ret = -errno; return true; @@ -607,7 +613,7 @@ if (msg->l2h == NULL) { /* first read our 3-byte header */ needed = sizeof(*hh) - msg->len; - discard = recv_discard_msg(&ret, fd, msg, needed); + discard = recv_discard_msg(&ret, fd, msg, needed, true); if (discard) goto discard_msg; @@ -648,7 +654,7 @@ needed = len - msgb_l2len(msg); if (needed > 0) { - discard = recv_discard_msg(&ret, fd, msg, needed); + discard = recv_discard_msg(&ret, fd, msg, needed, false); if (discard) goto discard_msg; -- To view, visit https://gerrit.osmocom.org/11912 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-MessageType: newchange Gerrit-Change-Id: I3cbdb3909660d605181d6923031336d296ea4340 Gerrit-Change-Number: 11912 Gerrit-PatchSet: 1 Gerrit-Owner: Max <msuraev at sysmocom.de> -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20181123/98fce761/attachment.htm>