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/.
laforge gerrit-no-reply at lists.osmocom.orglaforge has submitted this change. ( https://gerrit.osmocom.org/c/osmo-e1d/+/19056 ) Change subject: close timeslot socket if read or write returns negative ...................................................................... close timeslot socket if read or write returns negative If the user application has closed the timeslot socket, we will get error returns from read/write calls, which we must use to clean up the daemon-side state for this timeslot. Change-Id: I2e3e5010f36e916b4c8908af91447b3d3661123f --- M src/intf_line.c 1 file changed, 23 insertions(+), 4 deletions(-) Approvals: Jenkins Builder: Verified tnt: Looks good to me, but someone else must approve laforge: Looks good to me, approved diff --git a/src/intf_line.c b/src/intf_line.c index 9118232..7b85b4c 100644 --- a/src/intf_line.c +++ b/src/intf_line.c @@ -142,9 +142,12 @@ ); if (rv > 0) { + int bytes_to_write = rv; LOGP(DXFR, LOGL_DEBUG, "RX Message: %d %d [ %s]\n", ts->id, rv, osmo_hexdump(ts->rx_buf, rv)); - write(ts->fd, ts->rx_buf, rv); + rv = write(ts->fd, ts->rx_buf, bytes_to_write); + if (rv < 0) + return rv; } else if (rv < 0 && ts->id == 4) { LOGP(DXFR, LOGL_ERROR, "ERR RX: %d %d %d [ %s]\n", rv,oi,cl, osmo_hexdump(buf, len)); @@ -172,7 +175,8 @@ ts->id, rv, osmo_hexdump(ts->tx_buf, rv)); ts->tx_len = rv; ts->tx_ofs = 0; - } + } else if (rv < 0) + return rv; } /* */ @@ -234,9 +238,16 @@ l = _e1_tx_hdlcfs(ts, buf_ts, fts); break; default: + OSMO_ASSERT(0); continue; } + if (l < 0 && errno != EAGAIN) { + LOGP(DE1D, LOGL_ERROR, "dead socket during read: %s\n", + strerror(errno)); + e1_ts_stop(ts); + } + if (l <= 0) continue; @@ -269,6 +280,7 @@ { struct e1_ts *ts = &line->ts[tsn]; uint8_t buf_ts[ftr]; + int rv; if (ts->mode == E1_TS_MODE_OFF) continue; @@ -278,14 +290,21 @@ switch (ts->mode) { case E1_TS_MODE_RAW: - write(ts->fd, buf_ts, ftr); + rv = write(ts->fd, buf_ts, ftr); break; case E1_TS_MODE_HDLCFCS: - _e1_rx_hdlcfs(ts, buf_ts, ftr); + rv = _e1_rx_hdlcfs(ts, buf_ts, ftr); break; default: + OSMO_ASSERT(0); continue; } + if (rv < 0 && errno != EAGAIN) { + LOGP(DE1D, LOGL_ERROR, "dead socket during write: %s\n", + strerror(errno)); + e1_ts_stop(ts); + } + } return 0; -- To view, visit https://gerrit.osmocom.org/c/osmo-e1d/+/19056 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-e1d Gerrit-Branch: master Gerrit-Change-Id: I2e3e5010f36e916b4c8908af91447b3d3661123f Gerrit-Change-Number: 19056 Gerrit-PatchSet: 2 Gerrit-Owner: laforge <laforge at osmocom.org> Gerrit-Assignee: tnt <tnt at 246tNt.com> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: laforge <laforge at osmocom.org> Gerrit-Reviewer: tnt <tnt at 246tNt.com> Gerrit-MessageType: merged -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20200630/40d73dd8/attachment.htm>