Send goodbye packet before closing stream

Sending it after sending the substream end could incorrectly abort the
substream.
main
cel 6 years ago
parent bb26631cfb
commit 7cf62ba3e7

@ -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) err(1, "read");
if (sz == 0) { if (sz == 0) {
ps_write(bs, "true", 4, pkt_type_json, req_id, true, true); ps_write(bs, "true", 4, pkt_type_json, req_id, true, true);
ps_goodbye(bs);
return stream_state_ended_ok; return stream_state_ended_ok;
} }
ps_write(bs, buf, sz, ptype, req_id, true, false); ps_write(bs, buf, sz, ptype, req_id, true, false);
@ -1172,6 +1171,7 @@ do_tcp_connect:
if (rc < 0) warnx("tcsetattr"); if (rc < 0) warnx("tcsetattr");
} }
ps_goodbye(&bs);
bs_end(&bs); bs_end(&bs);
close(s); close(s);
return rc; return rc;

Loading…
Cancel
Save