Fix leak & logic error in send/receive connections.
This commit is contained in:
@@ -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() {
|
||||
|
||||
Reference in New Issue
Block a user