Adding TCP Keepalive Support to DBD::Sybase perl module

I’ve created a patch to enable support for CS_CON_KEEPALIVE (TCP keepalive packet SO_KEEPALIVE) in the DBD::Sybase v1.07 code. This will send an empty TCP keepalive ‘packet’ to the remote server.

"KeepAlive sets the value of the Sybase CT-Lib connection property CS_CON_KEEPALIVE to true or false. The default setting ensures that your connection is alive by sending packets to the database when the connection is idle. Set the value of this property to false for mobile clients that do not maintain constant connections." 

I’ve sent the patch to Michael Peppler.

diff dbdimp.h ../DBD-Sybase-1.07/dbdimp.h
< char keepalive[16];[/perl] [perl]diff dbdimp.c ../DBD-Sybase-1.07/dbdimp.c 1052d1051 < extractFromDsn("keepalive=", dsn, imp_dbh->keepalive, 10);
< < if (imp_dbh->keepalive[0]) {
< int keepalive = atoi(imp_dbh->keepalive);
< < if (keepalive != 1) { < keepalive = 0; < } < < if(DBIc_DBISTATE(imp_dbh)->debug >= 3)
< PerlIO_printf(DBIc_LOGPIO(imp_dbh), " syb_db_login() -> ct_config(CS_CON_KEEPALIVE,%d)\n”, keepalive);
< < if((retcode = ct_config(context, CS_SET, CS_CON_KEEPALIVE, &keepalive, CS_UNUSED, NULL)) != CS_SUCCEED) < warn("ct_config(CS_SET, CS_CON_KEEPALIVE) failed"); < } <[/perl]

Share Button

Leave a Reply

Your email address will not be published. Required fields are marked *