diff --git a/HISTORY b/HISTORY index c1497e6..0564155 100644 --- a/HISTORY +++ b/HISTORY @@ -1,5 +1,5 @@ -Version 1.06 2014-06-24 +Version 1.06 2014-06-27 * update source code from FastDFS V5.02 * add function short2buff and buff2short * add object memory pool (fast_mblock.h and fast_mblock.c) @@ -13,6 +13,7 @@ Version 1.06 2014-06-24 * #include to use C99 bool * add libfastcommon.spec for building RPM * logger can delete old rotated files + * bug fixed: connection pool should NOT increase counter when connect fail Version 1.05 2012-07-08 * update source code from FastDFS V3.09 diff --git a/src/connection_pool.c b/src/connection_pool.c index e272862..433d83c 100644 --- a/src/connection_pool.c +++ b/src/connection_pool.c @@ -202,6 +202,10 @@ ConnectionInfo *conn_pool_get_connection(ConnectionPool *cp, cp->connect_timeout); if (*err_no != 0) { + pthread_mutex_lock(&cm->lock); + cm->total_count--; //rollback + pthread_mutex_unlock(&cm->lock); + free(p); return NULL; }