Date: Monday, October 9, 2006 @ 19:30:57
Author: gilles
Path: /cvsroot/carob/carob
Modified: include/ConnectionParameters.hpp (1.29 -> 1.30)
include/DriverSocket.hpp (1.16 -> 1.17) include/JavaSocket.hpp
(1.31 -> 1.32) src/Connection.cpp (1.92 -> 1.93)
src/ConnectionParameters.cpp (1.23 -> 1.24) src/DriverSocket.cpp
(1.19 -> 1.20) src/JavaSocket.cpp (1.53 -> 1.54)
test/ConnectionSetup.cpp (1.13 -> 1.14)
Rolled-back socket timeout changes: this solution is way to dangerous (request
longer than timeout leads to reconnection process, then to failure of the
request)
----------------------------------+
include/ConnectionParameters.hpp | 14 +-------------
include/DriverSocket.hpp | 4 +---
include/JavaSocket.hpp | 4 +---
src/Connection.cpp | 3 +--
src/ConnectionParameters.cpp | 7 ++-----
src/DriverSocket.cpp | 4 ++--
src/JavaSocket.cpp | 20 +-------------------
test/ConnectionSetup.cpp | 6 ++----
8 files changed, 11 insertions(+), 51 deletions(-)
Index: carob/include/ConnectionParameters.hpp
diff -u carob/include/ConnectionParameters.hpp:1.29
carob/include/ConnectionParameters.hpp:1.30
--- carob/include/ConnectionParameters.hpp:1.29 Mon Oct 9 15:27:33 2006
+++ carob/include/ConnectionParameters.hpp Mon Oct 9 19:30:57 2006
@@ -103,8 +103,6 @@
static const bool DEFAULT_CONNECTION_PERSISTENCY;
/** Default for retrieve SQL warnings = false */
static const bool DEFAULT_RETRIEVE_SQL_WARNINGS;
- /** Default timeout in seconds = 0 (no timeout) */
- static const long DEFAULT_SOCKET_TIMEOUT;
/**
* Creates instance with a set of values:
@@ -119,8 +117,6 @@
* (default to false)
* @param retrieveSQLWarnings whether SQL Warnings should be retrieved
* (default to false)
- * @param socketTimeout read/write timeouts on sockets before aborting
- * transmissions (default to 0 = no timeout)
*/
ConnectionParameters(const std::vector<ControllerInfo>& ctrls,
const std::wstring& db = DEFAULT_DB,
@@ -128,8 +124,7 @@
const std::wstring& upass = DEFAULT_PASSWD,
ConnectPolicy cp = DEFAULT_POLICY,
bool persistentConnection =
DEFAULT_CONNECTION_PERSISTENCY,
- bool retrieveSQLWarnings =
DEFAULT_RETRIEVE_SQL_WARNINGS,
- long socketTimeout =
DEFAULT_SOCKET_TIMEOUT)
+ bool retrieveSQLWarnings =
DEFAULT_RETRIEVE_SQL_WARNINGS)
throw (ConnectionException, UnexpectedException);
virtual ~ConnectionParameters();
/**
@@ -163,8 +158,6 @@
bool getPersistentConnection() const { return
persistent_connections; }
/** Whether the controller should retrieve SQL warnings */
bool getRetrieveSQLWarnings() const { return
retrieve_sql_warnings; }
- /** Gives the socket operations timeout in seconds */
- long getSocketTimeout() const { return socket_timeout; }
private:
/** List of controllers to connect to */
std::vector<ControllerInfo> controller_list;
@@ -185,11 +178,6 @@
bool persistent_connections;
/** Whether to retrieve the sql warnings */
bool retrieve_sql_warnings;
- /**
- * Timeout (in seconds) after which socket operations should be considered as
- * failed. Zero value means no timeout
- */
- long socket_timeout;
};
} //namespace CarobNS
Index: carob/include/DriverSocket.hpp
diff -u carob/include/DriverSocket.hpp:1.16 carob/include/DriverSocket.hpp:1.17
--- carob/include/DriverSocket.hpp:1.16 Mon Oct 9 15:27:33 2006
+++ carob/include/DriverSocket.hpp Mon Oct 9 19:30:57 2006
@@ -39,11 +39,9 @@
* Constructor to directly connect to a host
* @param host host to connect to
* @param port port of the host to connect to
- * @param timeout delay before considering socket read/write operations as
- * failed
* @throws ConnectionException
*/
- DriverSocket(const std::wstring& host, in_addr_t port, long timeout)
+ DriverSocket(const std::wstring& host, in_addr_t port)
throw (ConnectionException, UnexpectedException);
/**
Index: carob/include/JavaSocket.hpp
diff -u carob/include/JavaSocket.hpp:1.31 carob/include/JavaSocket.hpp:1.32
--- carob/include/JavaSocket.hpp:1.31 Mon Oct 9 15:27:33 2006
+++ carob/include/JavaSocket.hpp Mon Oct 9 19:30:57 2006
@@ -72,12 +72,10 @@
* Creates the socket.
* @param blocking whether or not socket operations must be blocking (default
* is true, blocking socket)
- * @param timeout delay before considering read/write operations as failed
- * (default to 0 = no timeout)
* @return true upon successfull creation, false otherwise
* @throws ConnectionException
*/
- bool create(bool blocking = true, long timeout = 0)
+ bool create(bool blocking = true)
throw (ConnectionException, UnexpectedException);
/**
* Connects to the given host/port
Index: carob/src/Connection.cpp
diff -u carob/src/Connection.cpp:1.92 carob/src/Connection.cpp:1.93
--- carob/src/Connection.cpp:1.92 Mon Oct 9 15:27:33 2006
+++ carob/src/Connection.cpp Mon Oct 9 19:30:57 2006
@@ -171,8 +171,7 @@
//Here is the connection protocol...
// 1. connect to the controller
driverSocketPtr = new DriverSocket(connected_controller.getHostName(),
- connected_controller.getHostPort(),
- parameters.getSocketTimeout());
+ connected_controller.getHostPort());
// 2. sent the Protocol version information
*driverSocketPtr<<ProtocolVersion;
protocolVersionSend = true;
Index: carob/src/ConnectionParameters.cpp
diff -u carob/src/ConnectionParameters.cpp:1.23
carob/src/ConnectionParameters.cpp:1.24
--- carob/src/ConnectionParameters.cpp:1.23 Mon Oct 9 15:27:33 2006
+++ carob/src/ConnectionParameters.cpp Mon Oct 9 19:30:57 2006
@@ -103,7 +103,6 @@
const ConnectPolicy ConnectionParameters::DEFAULT_POLICY =
ROUND_ROBIN;
const bool ConnectionParameters::DEFAULT_CONNECTION_PERSISTENCY =
false ;
const bool ConnectionParameters::DEFAULT_RETRIEVE_SQL_WARNINGS =
false ;
-const long ConnectionParameters::DEFAULT_SOCKET_TIMEOUT = 0
;
ConnectionParameters::ConnectionParameters(
const std::vector<ControllerInfo>& ctrls,
@@ -112,16 +111,14 @@
const std::wstring& upass /*= DEFAULT_PASSWD*/,
ConnectPolicy cp /*= DEFAULT_POLICY*/,
bool persistentConnections /*= DEFAULT_CONNECTION_PERSISTENCY */,
- bool retrieveSQLWarnings /*= DEFAULT_RETRIEVE_SQL_WARNINGS */,
- long socketTimeout /*= DEFAULT_SOCKET_TIMEOUT */)
+ bool retrieveSQLWarnings /*= DEFAULT_RETRIEVE_SQL_WARNINGS */)
throw (ConnectionException, UnexpectedException) :
database_name(checkDatabaseName(db)),
user_name(uname),
user_pass(upass),
connect_policy(cp),
persistent_connections(persistentConnections),
- retrieve_sql_warnings(retrieveSQLWarnings),
- socket_timeout(socketTimeout)
+ retrieve_sql_warnings(retrieveSQLWarnings)
{
// Check the given controllers host names
for (std::vector<ControllerInfo>::const_iterator iter = ctrls.begin();
Index: carob/src/DriverSocket.cpp
diff -u carob/src/DriverSocket.cpp:1.19 carob/src/DriverSocket.cpp:1.20
--- carob/src/DriverSocket.cpp:1.19 Mon Oct 9 15:27:33 2006
+++ carob/src/DriverSocket.cpp Mon Oct 9 19:30:57 2006
@@ -28,11 +28,11 @@
using namespace CarobNS;
-DriverSocket::DriverSocket(const wstring& host, in_addr_t port, long timeout)
+DriverSocket::DriverSocket(const wstring& host, in_addr_t port)
throw (ConnectionException, UnexpectedException) : JavaSocket()
{
wstring fctName(L"DriverSocket::DriverSocket");
- if (JavaSocket::create(true, timeout))
+ if (JavaSocket::create(true))
JavaSocket::connectTo(host, port);
}
Index: carob/src/JavaSocket.cpp
diff -u carob/src/JavaSocket.cpp:1.53 carob/src/JavaSocket.cpp:1.54
--- carob/src/JavaSocket.cpp:1.53 Mon Oct 9 15:27:33 2006
+++ carob/src/JavaSocket.cpp Mon Oct 9 19:30:57 2006
@@ -53,7 +53,7 @@
closeSocket();
}
-bool JavaSocket::create(bool blocking /* = true */, long timeout /* = 0 */)
+bool JavaSocket::create(bool blocking /* = true */)
throw (ConnectionException, UnexpectedException)
{
wstring fctName(L"JavaSocket::Create");
@@ -112,24 +112,6 @@
return false;
}
- /* Set timeouts on socket if required */
- if (timeout > 0) /* also prevent zero timeout, which is useless ! */
- {
- // Set receive timeout in order to failover asap when network is down
- struct timeval timeoutStruct;
- timeoutStruct.tv_sec = timeout;
- timeoutStruct.tv_usec = 0;
- if (setsockopt(socketFd, SOL_SOCKET, SO_RCVTIMEO, &timeoutStruct,
sizeof(timeoutStruct)) < 0)
- {
- if (isErrorEnabled())
- logError(fctName, L"Could not set socket recv timeout ! failover can
thus be very slow !");
- }
- if (setsockopt(socketFd, SOL_SOCKET, SO_SNDTIMEO, &timeoutStruct,
sizeof(timeoutStruct)) < 0)
- {
- if (isErrorEnabled())
- logError(fctName, L"Could not set socket snd timeout ! failover can
thus be very slow !");
- }
- }
if (isDebugEnabled())
logDebug(fctName, L"Socket created.");
return true;
Index: carob/test/ConnectionSetup.cpp
diff -u carob/test/ConnectionSetup.cpp:1.13 carob/test/ConnectionSetup.cpp:1.14
--- carob/test/ConnectionSetup.cpp:1.13 Mon Oct 9 15:27:33 2006
+++ carob/test/ConnectionSetup.cpp Mon Oct 9 19:30:57 2006
@@ -47,8 +47,7 @@
ConnectionParameters::DEFAULT_PASSWD,
ConnectionParameters::DEFAULT_POLICY,
ConnectionParameters::DEFAULT_CONNECTION_PERSISTENCY,
-
ConnectionParameters::DEFAULT_RETRIEVE_SQL_WARNINGS,
- 10);
+
ConnectionParameters::DEFAULT_RETRIEVE_SQL_WARNINGS);
#else
// Put your controller settings here.
// Check this constructor for more details.
@@ -60,8 +59,7 @@
ConnectionParameters::DEFAULT_PASSWD,
ConnectionParameters::DEFAULT_POLICY,
ConnectionParameters::DEFAULT_CONNECTION_PERSISTENCY,
-
ConnectionParameters::DEFAULT_RETRIEVE_SQL_WARNINGS,
- 10);
+
ConnectionParameters::DEFAULT_RETRIEVE_SQL_WARNINGS);
#endif
try
{
_______________________________________________
Carob-commits mailing list
[email protected]
https://forge.continuent.org/mailman/listinfo/carob-commits