Skip to content

Commit

Permalink
Fixed proto_tls FD closing
Browse files Browse the repository at this point in the history
When sending through a TLS connection, do not close the FD if already in our process
x
  • Loading branch information
ionutrazvanionita committed Mar 13, 2015
1 parent ca12c67 commit 8de908d
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions modules/proto_tls/proto_tls.c
Expand Up @@ -1391,11 +1391,17 @@ static int proto_tls_send(struct socket_info* send_sock,
if (n<0){
LM_ERR("failed to send\n");
c->state=S_CONN_BAD;
if (c->proc_id != process_no)
close(fd);
tcp_conn_release(c, 0);
close(fd);
return -1;
}
close(fd);

/* only close the FD if not already in the context of our process
either we just connected, or main sent us the FD */
if (c->proc_id != process_no)
close(fd);

tcp_conn_release(c, 0);
return n;
}
Expand Down

0 comments on commit 8de908d

Please sign in to comment.