<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">hi, <div class=""><br class=""></div><div class="">Thanks for review. Is it better to ignore SIGPIPE in higher layer?</div><div class=""><br class=""></div><div class="">Yes, filter patch is trying to recovery playback by creating a fake EOS after ThreadRead fail to send data through broken socket, this would be better than keep trying to send data.</div><div class=""><br class=""></div><div class="">Any better suggestion?</div><div class=""><br class=""></div><div class=""><div>Thanks a lot!</div><div><br class=""><blockquote type="cite" class=""><div class="">2020年2月21日 下午3:59,Rémi Denis-Courmont <<a href="mailto:remi@remlab.net" class="">remi@remlab.net</a>> 写道:</div><br class="Apple-interchange-newline"><div class=""><span style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; float: none; display: inline !important;" class="">Hi,</span><br style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""><br style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""><span style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; float: none; display: inline !important;" class="">This looks like it'll break the build on all platforms but BSD derivatives. The filter patch has no rationale and looks like it'll cause spurious early EOS, thus breaking some streams.</span><br style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""><br style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""><div class="gmail_quote" style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;">Le 21 février 2020 09:33:46 GMT+02:00, Janboe Ye <<a href="mailto:janboe.ye@outlook.com" class="">janboe.ye@outlook.com</a>> a écrit :<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left-width: 1px; border-left-style: solid; border-left-color: rgb(204, 204, 204); padding-left: 1ex;"><pre class="k9mail">From 16540219ff8416395bd7994a6bb2fa9c5ab9984f Mon Sep 17 00:00:00 2001<br class="">From: Janboe Ye <<a href="mailto:janboe.ye@gmail.com" class="">janboe.ye@gmail.com</a>><br class="">Date: Fri, 21 Feb 2020 15:25:22 +0800<br class="">Subject: [PATCH] fix sigpipe crash and recover when bad network<br class=""><br class="">dsm will send sigpipe when bad network conditional and crash app.<br class="">This will disable sigpipe and recovery after writing failure<br class=""><br class="">Signed-off-by: Janboe Ye <<a href="mailto:janboe.ye@gmail.com" class="">janboe.ye@gmail.com</a>><hr class="">.../0001-setsockopt-to-disable-sigpipe.patch | 35 +++++++++++++++++++<br class="">contrib/src/libdsm/rules.mak | 1 +<br class="">modules/stream_filter/prefetch.c | 6 ++--<br class="">3 files changed, 39 insertions(+), 3 deletions(-)<br class="">create mode 100644 contrib/src/libdsm/0001-setsockopt-to-disable-sigpipe.patch<br class=""><br class="">diff --git a/contrib/src/libdsm/0001-setsockopt-to-disable-sigpipe.patch b/contrib/src/libdsm/0001-setsockopt-to-disable-sigpipe.patch<br class="">new file mode 100644<br class="">index 0000000000..107c5f3f64<br class="">--- /dev/null<br class="">+++ b/contrib/src/libdsm/0001-setsockopt-to-disable-sigpipe.patch<br class="">@@ -0,0 +1,35 @@<br class="">+From b53b1242323c715cee018ac189b9863eccd95240 Mon Sep 17 00:00:00 2001<br class="">+From: Janboe Ye <<a href="mailto:janboe.ye@gmail.com" class="">janboe.ye@gmail.com</a>><br class="">+Date: Fri, 21 Feb 2020 15:14:32 +0800<br class="">+Subject: [PATCH] setsockopt to disable sigpipe<br class="">+<br class="">+this signal will crash app when network goes wrong<br class="">+<br class="">+Signed-off-by: Janboe Ye <<a href="mailto:janboe.ye@gmail.com" class="">janboe.ye@gmail.com</a>><br class="">+---<br class="">+ src/netbios_session.c | 7 +++++++<br class="">+ 1 file changed, 7 insertions(+)<br class="">+<br class="">+diff --git a/src/netbios_session.c b/src/netbios_session.c<br class="">+index a77cbc7..7ae4dd0 100644<br class="">+--- a/src/netbios_session.c<br class="">++++ b/src/netbios_session.c<br class="">+@@ -54,8 +54,15 @@<br class="">+ <br class="">+ static int open_socket_and_connect(netbios_session *s)<br class="">+ {<br class="">++ int optval = 0;<br class="">+ if ((s->socket = socket(AF_INET, SOCK_STREAM, 0)) < 0)<br class="">+ goto error;<br class="">++<br class="">++ //Never generate SIGPIPE on broken write<br class="">++ optval = 1;<br class="">++ if (setsockopt(s->socket, SOL_SOCKET, SO_NOSIGPIPE, (void *)&optval, sizeof(int)))<br class="">++ goto error;<br class="">++<br class="">+ if (connect(s->socket, (struct sockaddr *)&s->remote_addr, sizeof(s->remote_addr)) <0)<br class="">+ goto error;<br class="">+ <br class="">+-- <br class="">+2.23.0<br class="">+<br class="">diff --git a/contrib/src/libdsm/rules.mak b/contrib/src/libdsm/rules.mak<br class="">index 1ea9b769b5..e7b9181865 100644<br class="">--- a/contrib/src/libdsm/rules.mak<br class="">+++ b/contrib/src/libdsm/rules.mak<br class="">@@ -24,6 +24,7 @@ libdsm: libdsm-$(LIBDSM_VERSION).tar.gz .sum-libdsm<br class=""> $(APPLY) $(SRC)/libdsm/fix-pc-generation.patch<br class=""> $(APPLY) $(SRC)/libdsm/fix-pipe-compat.patch<br class=""> $(APPLY) $(SRC)/libdsm/0001-compat-Don-t-use-_pipe-when-building-for-winstore.patch<br class="">+ $(APPLY) $(SRC)/libdsm/0001-setsockopt-to-disable-sigpipe.patch<br class=""> $(MOVE)<br class=""><br class="">DEPS_libdsm = libtasn1 iconv<br class="">diff --git a/modules/stream_filter/prefetch.c b/modules/stream_filter/prefetch.c<br class="">index a31f52c67f..1ae63094ea 100644<br class="">--- a/modules/stream_filter/prefetch.c<br class="">+++ b/modules/stream_filter/prefetch.c<br class="">@@ -238,13 +238,13 @@ static void *Thread(void *data)<br class=""> len = sys->buffer_size - offset;<br class=""><br class=""> ssize_t val = ThreadRead(stream, sys->buffer + offset, len);<br class="">- if (val < 0)<br class="">- continue;<br class="">- if (val == 0)<br class="">+<br class="">+ if (val <= 0)<br class=""> {<br class=""> assert(len > 0);<br class=""> msg_Dbg(stream, "end of stream");<br class=""> sys->eof = true;<br class="">+ val = 0;<br class=""> }<br class=""><br class=""> assert((size_t)val <= len);</pre></blockquote></div><br style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""><span style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; float: none; display: inline !important;" class="">--<span class="Apple-converted-space"> </span></span><br style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""><span style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; float: none; display: inline !important;" class="">Envoyé de mon appareil Android avec Courriel K-9 Mail. Veuillez excuser ma brièveté.</span></div></blockquote></div><br class=""></div></body></html>