CVS update: php3/functions

From: Date: Tue, 03 Nov 1998 03:16:59 +0000
Subject: CVS update: php3/functions
Groups: php.dev 
Request: Send a blank email to php-dev+get-2139@lists.php.net to get a copy of this message
Date: Monday November 2, 1998 @ 22:16 Author: tommay Update of /repository/php3/functions In directory asf:/u2/tmp/cvs-serv5747 Modified Files: sybase-ct.c Log Message: _close_sybct_link() and _close_sybct_plink() check the connection and death status to determine if and how to call ct_close(). Use CS_FORCE_CLOSE when closing known dead connections. Index: php3/functions/sybase-ct.c diff -c php3/functions/sybase-ct.c:1.47 php3/functions/sybase-ct.c:1.48 *** php3/functions/sybase-ct.c:1.47 Mon Nov 2 21:52:43 1998 --- php3/functions/sybase-ct.c Mon Nov 2 22:16:58 1998 *************** *** 27,33 **** +----------------------------------------------------------------------+ */ ! /* $Id: sybase-ct.c,v 1.47 1998/11/03 02:52:43 tommay Exp $ */ #ifndef MSVC5 --- 27,33 ---- +----------------------------------------------------------------------+ */ ! /* $Id: sybase-ct.c,v 1.48 1998/11/03 03:16:58 tommay Exp $ */ #ifndef MSVC5 *************** *** 137,145 **** static void _close_sybct_link(sybct_link *sybct_ptr) { sybct_ptr->valid = 0; _php3_hash_apply(resource_list,(int (*)(void *))_clean_invalid_results); ! ct_close(sybct_ptr->connection, CS_UNUSED); ct_con_drop(sybct_ptr->connection); efree(sybct_ptr); php3_sybct_module.num_links--; --- 137,166 ---- static void _close_sybct_link(sybct_link *sybct_ptr) { + CS_INT con_status; + sybct_ptr->valid = 0; _php3_hash_apply(resource_list,(int (*)(void *))_clean_invalid_results); ! ! /* Non-persistent connections will always be connected or we wouldn't ! * get here, but since we want to check the death status anyway ! * we might as well double-check the connect status. ! */ ! if (ct_con_props(sybct_ptr->connection, CS_GET, CS_CON_STATUS, ! &con_status, CS_UNUSED, NULL)!=CS_SUCCEED) { ! php3_error(E_WARNING,"Sybase: Unable to get connection status on close"); ! /* Assume the worst. */ ! con_status = CS_CONSTAT_CONNECTED | CS_CONSTAT_DEAD; ! } ! if (con_status & CS_CONSTAT_CONNECTED) { ! if (con_status & CS_CONSTAT_DEAD) { ! ct_close(sybct_ptr->connection, CS_FORCE_CLOSE); ! } ! else { ! ct_close(sybct_ptr->connection, CS_UNUSED); ! } ! } ! ct_con_drop(sybct_ptr->connection); efree(sybct_ptr); php3_sybct_module.num_links--; *************** *** 148,154 **** static void _close_sybct_plink(sybct_link *sybct_ptr) { ! ct_close(sybct_ptr->connection, CS_UNUSED); ct_con_drop(sybct_ptr->connection); free(sybct_ptr); php3_sybct_module.num_persistent--; --- 169,194 ---- static void _close_sybct_plink(sybct_link *sybct_ptr) { ! CS_INT con_status; ! ! /* Persistent connections may have been closed before a failed ! * reopen attempt. ! */ ! if (ct_con_props(sybct_ptr->connection, CS_GET, CS_CON_STATUS, ! &con_status, CS_UNUSED, NULL)!=CS_SUCCEED) { ! php3_error(E_WARNING,"Sybase: Unable to get connection status on close"); ! /* Assume the worst. */ ! con_status = CS_CONSTAT_CONNECTED | CS_CONSTAT_DEAD; ! } ! if (con_status & CS_CONSTAT_CONNECTED) { ! if (con_status & CS_CONSTAT_DEAD) { ! ct_close(sybct_ptr->connection, CS_FORCE_CLOSE); ! } ! else { ! ct_close(sybct_ptr->connection, CS_UNUSED); ! } ! } ! ct_con_drop(sybct_ptr->connection); free(sybct_ptr); php3_sybct_module.num_persistent--; *************** *** 409,415 **** } if (!(con_status & CS_CONSTAT_CONNECTED) || (con_status & CS_CONSTAT_DEAD)) { if (con_status & CS_CONSTAT_CONNECTED) { ! ct_close(sybct_ptr->connection, CS_UNUSED); } /* Create a new connection, then replace the old * connection. If we fail to create a new connection, --- 449,455 ---- } if (!(con_status & CS_CONSTAT_CONNECTED) || (con_status & CS_CONSTAT_DEAD)) { if (con_status & CS_CONSTAT_CONNECTED) { ! ct_close(sybct_ptr->connection, CS_FORCE_CLOSE); } /* Create a new connection, then replace the old * connection. If we fail to create a new connection, -- PHP Development Mailing List http://www.php.net/ To unsubscribe send an empty message to php-dev-unsubscribe@lists.php.net For help: php-dev-help@lists.php.net

« previous php.dev (#2139) next »