|
From: <di...@us...> - 2010-10-31 13:47:00
|
Revision: 51812
http://firebird.svn.sourceforge.net/firebird/?rev=51812&view=rev
Author: dimitr
Date: 2010-10-31 13:46:54 +0000 (Sun, 31 Oct 2010)
Log Message:
-----------
Basic network support for the fb_ping() API call. Untested yet.
Modified Paths:
--------------
firebird/trunk/src/remote/client/interface.cpp
firebird/trunk/src/remote/protocol.cpp
firebird/trunk/src/remote/protocol.h
firebird/trunk/src/remote/server/server.cpp
Modified: firebird/trunk/src/remote/client/interface.cpp
===================================================================
--- firebird/trunk/src/remote/client/interface.cpp 2010-10-31 13:40:19 UTC (rev 51811)
+++ firebird/trunk/src/remote/client/interface.cpp 2010-10-31 13:46:54 UTC (rev 51812)
@@ -4347,8 +4347,28 @@
* Check the attachment handle for persistent errors.
*
**************************************/
+ try
+ {
+ reset(status);
- reset(status);
+ CHECK_HANDLE(rdb, isc_bad_db_handle);
+ rem_port* port = rdb->rdb_port;
+ RefMutexGuard portGuard(*port->port_sync);
+
+ // Make sure protocol support action
+
+ if (rdb->rdb_port->port_protocol < PROTOCOL_VERSION13)
+ unsupported();
+
+ PACKET* packet = &rdb->rdb_packet;
+ packet->p_operation = op_ping;
+
+ send_and_receive(status, rdb, packet);
+ }
+ catch (const Exception& ex)
+ {
+ ex.stuffException(status);
+ }
}
static Rvnt* add_event( rem_port* port)
@@ -6628,7 +6648,7 @@
if (port->port_protocol < PROTOCOL_VERSION12 || port->port_type != rem_port::INET)
{
- Arg::Gds(isc_wish_list).raise();
+ unsupported();
}
MutexEnsureUnlock guard(rdb->rdb_async_lock); // This is async operation
Modified: firebird/trunk/src/remote/protocol.cpp
===================================================================
--- firebird/trunk/src/remote/protocol.cpp 2010-10-31 13:40:19 UTC (rev 51811)
+++ firebird/trunk/src/remote/protocol.cpp 2010-10-31 13:46:54 UTC (rev 51812)
@@ -277,6 +277,7 @@
case op_reject:
case op_disconnect:
case op_dummy:
+ case op_ping:
return P_TRUE(xdrs, p);
case op_connect:
Modified: firebird/trunk/src/remote/protocol.h
===================================================================
--- firebird/trunk/src/remote/protocol.h 2010-10-31 13:40:19 UTC (rev 51811)
+++ firebird/trunk/src/remote/protocol.h 2010-10-31 13:46:54 UTC (rev 51812)
@@ -298,6 +298,8 @@
op_cont_auth = 92,
+ op_ping = 93,
+
op_max
};
Modified: firebird/trunk/src/remote/server/server.cpp
===================================================================
--- firebird/trunk/src/remote/server/server.cpp 2010-10-31 13:40:19 UTC (rev 51811)
+++ firebird/trunk/src/remote/server/server.cpp 2010-10-31 13:46:54 UTC (rev 51812)
@@ -553,6 +553,7 @@
static bool get_next_msg_no(Rrq*, USHORT, USHORT*);
static Rtr* make_transaction(Rdb*, FB_API_HANDLE);
+static void ping_connection(rem_port*, PACKET*);
static bool process_packet(rem_port* port, PACKET* sendL, PACKET* receive, rem_port** result);
static void release_blob(Rbl*);
static void release_event(Rvnt*);
@@ -3222,6 +3223,30 @@
}
+static void ping_connection(rem_port* port, PACKET* send)
+{
+/**************************************
+ *
+ * p i n g _ c o n n e c t i o n
+ *
+ **************************************
+ *
+ * Functional description
+ * Check the connection for persistent errors.
+ *
+ **************************************/
+ ISC_STATUS_ARRAY status_vector;
+
+ Rdb* rdb = port->port_context;
+ if (!bad_db(status_vector, rdb))
+ {
+ fb_ping(status_vector, &rdb->rdb_handle);
+ }
+
+ port->send_response(send, 0, 0, status_vector, false);
+}
+
+
ISC_STATUS rem_port::open_blob(P_OP op, P_BLOB* stuff, PACKET* sendL)
{
/**************************************
@@ -3705,6 +3730,10 @@
cancel_operation(port, receive->p_cancel_op.p_co_kind);
break;
+ case op_ping:
+ ping_connection(port, sendL);
+ break;
+
default:
gds__log("SERVER/process_packet: don't understand packet type %d", receive->p_operation);
port->port_state = rem_port::BROKEN;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|