Fix leak & logic error in send/receive connections.

This commit is contained in:
Ian Gulliver
2016-03-06 18:49:41 -08:00
parent 6480a960fa
commit 352d14935f

View File

@@ -5,6 +5,7 @@
#include "flow.h"
#include "list.h"
#include "log.h"
#include "peer.h"
#include "receive.h"
#include "send.h"
@@ -54,10 +55,10 @@ static void send_receive_new(int fd, void *passthrough, struct peer *on_close) {
send_receive->ref_count = 2;
list_add(&send_receive->send_receive_list, &send_receive_head);
flow_new(fd, send_flow, passthrough, on_close);
flow_new(fd, send_flow, passthrough, (struct peer *) send_receive);
int fd2 = fcntl(fd, F_DUPFD_CLOEXEC, 0);
assert(fd2 >= 0);
flow_new(fd2, receive_flow, NULL, on_close);
flow_new(fd2, receive_flow, NULL, (struct peer *) send_receive);
}
void send_receive_cleanup() {