From 7cf62ba3e700308e0b1f40b9293000389ba9b60d Mon Sep 17 00:00:00 2001 From: cel Date: Sun, 16 Dec 2018 18:24:55 -1000 Subject: [PATCH] Send goodbye packet before closing stream Sending it after sending the substream end could incorrectly abort the substream. --- sbotc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sbotc.c b/sbotc.c index db3bdff..c2d2942 100644 --- a/sbotc.c +++ b/sbotc.c @@ -776,7 +776,6 @@ static enum stream_state muxrpc_write_sink_1(struct boxs *bs, int infd, if (sz < 0) err(1, "read"); if (sz == 0) { ps_write(bs, "true", 4, pkt_type_json, req_id, true, true); - ps_goodbye(bs); return stream_state_ended_ok; } ps_write(bs, buf, sz, ptype, req_id, true, false); @@ -1172,6 +1171,7 @@ do_tcp_connect: if (rc < 0) warnx("tcsetattr"); } + ps_goodbye(&bs); bs_end(&bs); close(s); return rc;