CVS update: php3/functions
| From: | tommay | Date: | Thu, 19 Nov 1998 02:52:16 +0000 |
| Subject: | CVS update: php3/functions | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-2471@lists.php.net to get a copy of this message | ||
Date: Wednesday November 18, 1998 @ 21:52
Author: tommay
Update of /repository/php3/functions
In directory asf:/u2/tmp/cvs-serv12100
Modified Files:
sybase-ct.c
Log Message:
Added login timeouts and command timeouts. They are specified in php3.ini
as sybct.login_timeout and sybct.timeout, respectively, and are given in
seconds. If they are not specified, CT-Lib defaults are 1 minute and
unlimited respectively, and no behavior should change except that a login
will actually be timed out after 1 minute whereas before I think they
would timeout but then automatically be retried or re-waited for since
the client message callback always returned CS_SUCCEED.
Index: php3/functions/sybase-ct.c
diff -c php3/functions/sybase-ct.c:1.56 php3/functions/sybase-ct.c:1.57
*** php3/functions/sybase-ct.c:1.56 Mon Nov 9 13:30:40 1998
--- php3/functions/sybase-ct.c Wed Nov 18 21:52:15 1998
***************
*** 28,34 ****
+----------------------------------------------------------------------+
*/
! /* $Id: sybase-ct.c,v 1.56 1998/11/09 18:30:40 tommay Exp $ */
#ifndef MSVC5
--- 28,34 ----
+----------------------------------------------------------------------+
*/
! /* $Id: sybase-ct.c,v 1.57 1998/11/19 02:52:15 tommay Exp $ */
#ifndef MSVC5
***************
*** 198,203 ****
--- 198,215 ----
if (CS_SEVERITY(errmsg->msgnumber) >= php3_sybct_module.min_client_severity) {
php3_error(E_WARNING,"Sybase: Client message: %s (severity
%d)",errmsg->msgstring, CS_SEVERITY(errmsg->msgnumber));
}
+
+ /* If this is a timeout message, return CS_FAIL to cancel the
+ * operation and mark the connection as dead.
+ */
+ if (CS_SEVERITY(errmsg->msgnumber) == CS_SV_RETRY_FAIL &&
+ CS_NUMBER(errmsg->msgnumber) == 63 &&
+ CS_ORIGIN(errmsg->msgnumber) == 2 &&
+ CS_LAYER(errmsg->msgnumber) == 1)
+ {
+ return CS_FAIL;
+ }
+
return CS_SUCCEED;
}
***************
*** 230,235 ****
--- 242,249 ----
int php3_minit_sybct(INIT_FUNC_ARGS)
{
+ long timeout;
+
if (cs_ctx_alloc(CTLIB_VERSION, &context)!=CS_SUCCEED ||
ct_init(context,CTLIB_VERSION)!=CS_SUCCEED) {
return FAILURE;
}
***************
*** 252,257 ****
--- 266,293 ----
CS_INT dt_convfmt = CS_DATES_SHORT;
if (cs_dt_info(context, CS_SET, NULL, CS_DT_CONVFMT, CS_UNUSED, &dt_convfmt,
sizeof(dt_convfmt), NULL)!=CS_SUCCEED) {
php3_error(E_WARNING,"Sybase: Unable to set datetime conversion format");
+ }
+ }
+
+ /* Set the login and command timeouts. These are per-context and
+ * can't be set with ct_con_props(), so set them globally from
+ * their config values if requested. The defaults are 1 minute
+ * for CS_LOGIN_TIMEOUT and CS_NO_LIMIT for CS_TIMEOUT. The latter
+ * especially is fairly useless for web applications.
+ * Note that depite some noise in the documentation about using
+ * signals to implement timeouts, they are actually implemented
+ * by using poll() or select() on Solaris and Linux.
+ */
+ if (cfg_get_long("sybct.login_timeout",&timeout)==SUCCESS) {
+ CS_INT cs_login_timeout = timeout;
+ if (ct_config(context, CS_SET, CS_LOGIN_TIMEOUT, &cs_login_timeout, CS_UNUSED,
NULL)!=CS_SUCCEED) {
+ php3_error(E_WARNING,"Sybase: Unable to set login timeoutt");
+ }
+ }
+ if (cfg_get_long("sybct.timeout",&timeout)==SUCCESS) {
+ CS_INT cs_timeout = timeout;
+ if (ct_config(context, CS_SET, CS_TIMEOUT, &cs_timeout, CS_UNUSED, NULL)!=CS_SUCCEED) {
+ php3_error(E_WARNING,"Sybase: Unable to set timeout");
}
}
--
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