comparison src/dnsbl.cpp @ 63:579dc5955cbe

only keep 20% of the open resolver sockets in the ready pool.
author carl
date Sun, 16 Jan 2005 08:33:55 -0800
parents 7ad7d8b100bf
children 6add229288a8
comparison
equal deleted inserted replaced
62:7ad7d8b100bf 63:579dc5955cbe
442 my_disconnect(fd); 442 my_disconnect(fd);
443 } 443 }
444 else { 444 else {
445 int result = pthread_mutex_lock(&fd_pool_mutex); 445 int result = pthread_mutex_lock(&fd_pool_mutex);
446 if (!result) { 446 if (!result) {
447 if (resolver_sock_count > resolver_pool_size*5) { 447 if ((resolver_sock_count > resolver_pool_size*5) || (resolver_pool_size < 5)) {
448 // return the fd to the pool 448 // return the fd to the pool
449 fd_pool.insert(fd); 449 fd_pool.insert(fd);
450 resolver_pool_size++; 450 resolver_pool_size++;
451 } 451 }
452 else { 452 else {
453 // more than 20% of the open resolver sockets are in the pool 453 // more than 20% of the open resolver sockets are in the pool, and the
454 // that is enough, so just close this one. 454 // pool as at least 5 sockets. that is enough, so just close this one.
455 my_disconnect(fd); 455 my_disconnect(fd);
456 } 456 }
457 pthread_mutex_unlock(&fd_pool_mutex); 457 pthread_mutex_unlock(&fd_pool_mutex);
458 } 458 }
459 else { 459 else {