diff options
Diffstat (limited to 'contrib/ntp/libntp/recvbuff.c')
-rw-r--r-- | contrib/ntp/libntp/recvbuff.c | 28 |
1 files changed, 15 insertions, 13 deletions
diff --git a/contrib/ntp/libntp/recvbuff.c b/contrib/ntp/libntp/recvbuff.c index 73ebe88..f888950 100644 --- a/contrib/ntp/libntp/recvbuff.c +++ b/contrib/ntp/libntp/recvbuff.c @@ -156,18 +156,15 @@ uninit_recvbuff(void) void freerecvbuf(recvbuf_t *rb) { - if (rb == NULL) { - msyslog(LOG_ERR, "freerecvbuff received NULL buffer"); - return; + if (rb) { + LOCK(); + rb->used--; + if (rb->used != 0) + msyslog(LOG_ERR, "******** freerecvbuff non-zero usage: %d *******", rb->used); + LINK_SLIST(free_recv_list, rb, link); + free_recvbufs++; + UNLOCK(); } - - LOCK(); - rb->used--; - if (rb->used != 0) - msyslog(LOG_ERR, "******** freerecvbuff non-zero usage: %d *******", rb->used); - LINK_SLIST(free_recv_list, rb, link); - free_recvbufs++; - UNLOCK(); } @@ -264,7 +261,7 @@ get_full_recv_buffer(void) */ void purge_recv_buffers_for_fd( - SOCKET fd + int fd ) { recvbuf_t *rbufp; @@ -277,7 +274,12 @@ purge_recv_buffers_for_fd( rbufp != NULL; rbufp = next) { next = rbufp->link; - if (rbufp->fd == fd) { +# ifdef HAVE_IO_COMPLETION_PORT + if (rbufp->dstadr == NULL && rbufp->fd == fd) +# else + if (rbufp->fd == fd) +# endif + { UNLINK_MID_FIFO(punlinked, full_recv_fifo, rbufp, link, recvbuf_t); INSIST(punlinked == rbufp); |