End duplex stream when output ends

main
cel 6 years ago
parent 1412c8b5f9
commit 7c6272311b

@ -685,8 +685,7 @@ static int bs_passthrough(struct boxs *bs, int infd, int outfd) {
enum stream_state in = stream_state_open;
enum stream_state out = stream_state_open;
while (out == stream_state_open
|| (in == stream_state_open && out != stream_state_ended_error)) {
while (out == stream_state_open) {
FD_ZERO(&rd);
if (in == stream_state_open) FD_SET(infd, &rd);
if (out == stream_state_open) FD_SET(sfd, &rd);
@ -864,7 +863,7 @@ static int muxrpc_write_blob_add(struct boxs *bs, int infd, int outfd, int req_i
in == stream_state_ended_error || out == stream_state_ended_error ? 2 : 1;
}
static int muxrpc_duplex(struct boxs *bs, int infd, int outfd, enum pkt_type in_ptype, int req_id, bool no_newline, bool raw) {
static int muxrpc_duplex(struct boxs *bs, int infd, int outfd, enum pkt_type in_ptype, int req_id, bool no_newline) {
int rc;
fd_set rd;
int sfd = bs->s;
@ -872,8 +871,7 @@ static int muxrpc_duplex(struct boxs *bs, int infd, int outfd, enum pkt_type in_
enum stream_state in = stream_state_open;
enum stream_state out = stream_state_open;
while (out == stream_state_open
|| (!raw && in == stream_state_open && out != stream_state_ended_error)) {
while (out == stream_state_open) {
FD_ZERO(&rd);
if (in == stream_state_open) FD_SET(infd, &rd);
if (out == stream_state_open) FD_SET(sfd, &rd);
@ -1201,7 +1199,7 @@ do_tcp_connect:
}
break;
case muxrpc_type_duplex:
rc = muxrpc_duplex(&bs, STDIN_FILENO, STDOUT_FILENO, ptype, 1, no_newline, raw);
rc = muxrpc_duplex(&bs, STDIN_FILENO, STDOUT_FILENO, ptype, 1, no_newline);
break;
}

Loading…
Cancel
Save