mirror of
https://github.com/gyurix1968/guacamole-client.git
synced 2025-09-06 05:07:41 +00:00
GUACAMOLE-919: pass postgres driver socketTimout
This commit is contained in:
@@ -111,6 +111,9 @@ public class PostgreSQLAuthenticationProviderModule implements Module {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Handle case where TCP connection to database is silently dropped
|
||||||
|
driverProperties.setProperty("socketTimeout", String.valueOf(environment.getPostgreSQLSocketTimeout()));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@@ -56,6 +56,13 @@ public class PostgreSQLEnvironment extends JDBCEnvironment {
|
|||||||
*/
|
*/
|
||||||
private static final String DEFAULT_DEFAULT_STATEMENT_TIMEOUT = "null";
|
private static final String DEFAULT_DEFAULT_STATEMENT_TIMEOUT = "null";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The default socketTimeout (in seconds), if POSTGRESQL_SOCKET_TIMEOUT is not specified.
|
||||||
|
* Default to 0 (no timeout)
|
||||||
|
* https://jdbc.postgresql.org/documentation/head/connect.html
|
||||||
|
*/
|
||||||
|
private static final int DEFAULT_SOCKET_TIMEOUT = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Whether a database user account is required by default for authentication
|
* Whether a database user account is required by default for authentication
|
||||||
* to succeed.
|
* to succeed.
|
||||||
@@ -275,6 +282,23 @@ public class PostgreSQLEnvironment extends JDBCEnvironment {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the socketTimeout property to set on PostgreSQL connections.
|
||||||
|
* If unspecified, this will be the default to 0 (no timeout)
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
* The socketTimeout to use when waiting on read operations (in seconds)
|
||||||
|
*
|
||||||
|
* @throws GuacamoleException
|
||||||
|
* If an error occurs while retrieving the property value.
|
||||||
|
*/
|
||||||
|
public int getPostgreSQLSocketTimeout() throws GuacamoleException {
|
||||||
|
return getProperty(
|
||||||
|
PostgreSQLGuacamoleProperties.POSTGRESQL_SOCKET_TIMEOUT,
|
||||||
|
DEFAULT_SOCKET_TIMEOUT
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isRecursiveQuerySupported(SqlSession session) {
|
public boolean isRecursiveQuerySupported(SqlSession session) {
|
||||||
return true; // All versions of PostgreSQL support recursive queries through CTEs
|
return true; // All versions of PostgreSQL support recursive queries through CTEs
|
||||||
|
@@ -106,6 +106,18 @@ public class PostgreSQLGuacamoleProperties {
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the number of seconds the driver will wait in a read() call
|
||||||
|
* on the TCP connection to the database.
|
||||||
|
*/
|
||||||
|
public static final IntegerGuacamoleProperty
|
||||||
|
POSTGRESQL_SOCKET_TIMEOUT = new IntegerGuacamoleProperty(){
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getName() { return "postgresql-socket-timeout"; }
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Whether a user account within the database is required for authentication
|
* Whether a user account within the database is required for authentication
|
||||||
* to succeed, even if the user has been authenticated via another
|
* to succeed, even if the user has been authenticated via another
|
||||||
|
@@ -362,6 +362,10 @@ END
|
|||||||
"postgresql-user-required" \
|
"postgresql-user-required" \
|
||||||
"$POSTGRES_USER_REQUIRED"
|
"$POSTGRES_USER_REQUIRED"
|
||||||
|
|
||||||
|
set_optional_property \
|
||||||
|
"postgresql-socket-timeout" \
|
||||||
|
"$POSTGRES_SOCKET_TIMEOUT"
|
||||||
|
|
||||||
set_optional_property \
|
set_optional_property \
|
||||||
"postgresql-ssl-mode" \
|
"postgresql-ssl-mode" \
|
||||||
"$POSTGRESQL_SSL_MODE"
|
"$POSTGRESQL_SSL_MODE"
|
||||||
|
Reference in New Issue
Block a user