... | ... |
@@ -282,7 +282,7 @@ void _tcpconn_rm(struct tcp_connection* c) |
282 | 282 |
tcpconn_listrm(tcpconn_id_hash[c->id_hash], c, id_next, id_prev); |
283 | 283 |
lock_destroy(&c->write_lock); |
284 | 284 |
#ifdef USE_TLS |
285 |
- if ((c->type==PROTO_TLS)&&(c->extra_data)) tls_tcpconn_clean(c); |
|
285 |
+ if (c->type==PROTO_TLS) tls_tcpconn_clean(c); |
|
286 | 286 |
#endif |
287 | 287 |
shm_free(c); |
288 | 288 |
} |
... | ... |
@@ -505,7 +505,8 @@ void tcpconn_timeout(fd_set* set) |
505 | 505 |
{ |
506 | 506 |
struct tcp_connection *c, *next; |
507 | 507 |
int ticks; |
508 |
- unsigned h;; |
|
508 |
+ unsigned h; |
|
509 |
+ int fd; |
|
509 | 510 |
|
510 | 511 |
|
511 | 512 |
ticks=get_ticks(); |
... | ... |
@@ -517,11 +518,12 @@ void tcpconn_timeout(fd_set* set) |
517 | 518 |
if ((c->refcnt==0) && (ticks>c->timeout)) { |
518 | 519 |
DBG("tcpconn_timeout: timeout for hash=%d - %p (%d > %d)\n", |
519 | 520 |
h, c, ticks, c->timeout); |
520 |
- if (c->s>0) { |
|
521 |
- FD_CLR(c->s, set); |
|
522 |
- close(c->s); |
|
523 |
- } |
|
521 |
+ fd=c->s; |
|
524 | 522 |
_tcpconn_rm(c); |
523 |
+ if (fd>0) { |
|
524 |
+ FD_CLR(fd, set); |
|
525 |
+ close(fd); |
|
526 |
+ } |
|
525 | 527 |
} |
526 | 528 |
c=next; |
527 | 529 |
} |
... | ... |
@@ -717,6 +719,7 @@ void tcp_main_loop() |
717 | 719 |
int cmd; |
718 | 720 |
int bytes; |
719 | 721 |
struct timeval timeout; |
722 |
+ int fd; |
|
720 | 723 |
|
721 | 724 |
/*init */ |
722 | 725 |
maxfd=0; |
... | ... |
@@ -783,8 +786,9 @@ void tcp_main_loop() |
783 | 786 |
"children available\n"); |
784 | 787 |
TCPCONN_LOCK; |
785 | 788 |
if (tcpconn->refcnt==0){ |
786 |
- close(tcpconn->s); |
|
789 |
+ fd=tcpconn->s; |
|
787 | 790 |
_tcpconn_rm(tcpconn); |
791 |
+ close(fd); |
|
788 | 792 |
}else tcpconn->timeout=0; /* force expire*/ |
789 | 793 |
TCPCONN_UNLOCK; |
790 | 794 |
} |
... | ... |
@@ -855,8 +859,9 @@ read_again: |
855 | 859 |
tcpconn->refcnt--; |
856 | 860 |
if (tcpconn->refcnt==0){ |
857 | 861 |
DBG("tcp_main_loop: destroying connection\n"); |
858 |
- close(tcpconn->s); |
|
862 |
+ fd=tcpconn->s; |
|
859 | 863 |
_tcpconn_rm(tcpconn); |
864 |
+ close(fd); |
|
860 | 865 |
}else{ |
861 | 866 |
/* force timeout */ |
862 | 867 |
tcpconn->timeout=0; |
... | ... |
@@ -529,6 +529,7 @@ again: |
529 | 529 |
|
530 | 530 |
|
531 | 531 |
end_req: |
532 |
+ |
|
532 | 533 |
return resp; |
533 | 534 |
} |
534 | 535 |
|
... | ... |
@@ -540,6 +541,7 @@ void release_tcpconn(struct tcp_connection* c, long state, int unix_sock) |
540 | 541 |
|
541 | 542 |
DBG( "releasing con %p, state %ld, fd=%d, id=%d\n", |
542 | 543 |
c, state, c->fd, c->id); |
544 |
+ DBG(" extra_data %p\n", c->extra_data); |
|
543 | 545 |
/* release req & signal the parent */ |
544 | 546 |
if (c->fd!=-1) close(c->fd); |
545 | 547 |
/* errno==EINTR, EWOULDBLOCK a.s.o todo */ |