Implement a new davmail.clientSoTimeout setting to adjust or disable connection timeout

git-svn-id: http://svn.code.sf.net/p/davmail/code/trunk@1902 3d1905a2-6b24-0410-a738-b14d5a86fcbd
This commit is contained in:
mguessan 2012-02-07 23:15:31 +00:00
parent d53967aa6e
commit 0c515256d2
7 changed files with 19 additions and 2 deletions

View File

@ -152,7 +152,7 @@ public abstract class AbstractServer extends Thread {
while (true) {
clientSocket = serverSocket.accept();
// set default timeout to 5 minutes
clientSocket.setSoTimeout(300000);
clientSocket.setSoTimeout(Settings.getIntProperty("davmail.clientSoTimeout", 300)*1000);
DavGatewayTray.debug(new BundleMessage("LOG_CONNECTION_FROM", clientSocket.getInetAddress(), port));
// only accept localhost connections for security reasons
if (Settings.getBooleanProperty("davmail.allowRemote") ||

View File

@ -136,6 +136,7 @@ public final class Settings {
SETTINGS.put("davmail.smtpPort", "1025");
SETTINGS.put("davmail.caldavPort", "1080");
SETTINGS.put("davmail.ldapPort", "1389");
SETTINGS.put("davmail.clientSoTimeout", "");
SETTINGS.put("davmail.keepDelay", "30");
SETTINGS.put("davmail.sentKeepDelay", "90");
SETTINGS.put("davmail.caldavPastDelay", "90");

View File

@ -70,6 +70,7 @@ public class SettingsFrame extends JFrame {
JCheckBox allowRemoteField;
JTextField bindAddressField;
JTextField clientSoTimeoutField;
JTextField certHashField;
JCheckBox disableUpdateCheck;
@ -372,18 +373,21 @@ public class SettingsFrame extends JFrame {
}
protected JPanel getNetworkSettingsPanel() {
JPanel networkSettingsPanel = new JPanel(new GridLayout(3, 2));
JPanel networkSettingsPanel = new JPanel(new GridLayout(4, 2));
networkSettingsPanel.setBorder(BorderFactory.createTitledBorder(BundleMessage.format("UI_NETWORK")));
allowRemoteField = new JCheckBox();
allowRemoteField.setSelected(Settings.getBooleanProperty("davmail.allowRemote"));
bindAddressField = new JTextField(Settings.getProperty("davmail.bindAddress"), 15);
clientSoTimeoutField = new JTextField(Settings.getProperty("davmail.clientSoTimeout"), 15);;
certHashField = new JTextField(Settings.getProperty("davmail.server.certificate.hash"), 15);
addSettingComponent(networkSettingsPanel, BundleMessage.format("UI_BIND_ADDRESS"), bindAddressField,
BundleMessage.format("UI_BIND_ADDRESS_HELP"));
addSettingComponent(networkSettingsPanel, BundleMessage.format("UI_CLIENT_SO_TIMEOUT"), clientSoTimeoutField,
BundleMessage.format("UI_CLIENT_SO_TIMEOUT_HELP"));
addSettingComponent(networkSettingsPanel, BundleMessage.format("UI_ALLOW_REMOTE_CONNECTION"), allowRemoteField,
BundleMessage.format("UI_ALLOW_REMOTE_CONNECTION_HELP"));
addSettingComponent(networkSettingsPanel, BundleMessage.format("UI_SERVER_CERTIFICATE_HASH"), certHashField,
@ -557,6 +561,7 @@ public class SettingsFrame extends JFrame {
disableUpdateCheck.setSelected(Settings.getBooleanProperty(("davmail.disableUpdateCheck")));
caldavEditNotificationsField.setSelected(Settings.getBooleanProperty("davmail.caldavEditNotifications"));
clientSoTimeoutField.setText(Settings.getProperty("davmail.clientSoTimeout"));
caldavAlarmSoundField.setText(Settings.getProperty("davmail.caldavAlarmSound"));
forceActiveSyncUpdateCheckBox.setSelected(Settings.getBooleanProperty("davmail.forceActiveSyncUpdate"));
defaultDomainField.setText(Settings.getProperty("davmail.defaultDomain"));
@ -695,6 +700,7 @@ public class SettingsFrame extends JFrame {
Settings.setProperty("davmail.proxyPassword", httpProxyPasswordField.getText());
Settings.setProperty("davmail.bindAddress", bindAddressField.getText());
Settings.setProperty("davmail.clientSoTimeout", String.valueOf(clientSoTimeoutField.getText()));
Settings.setProperty("davmail.allowRemote", String.valueOf(allowRemoteField.isSelected()));
Settings.setProperty("davmail.server.certificate.hash", certHashField.getText());
Settings.setProperty("davmail.disableUpdateCheck", String.valueOf(disableUpdateCheck.isSelected()));

View File

@ -183,6 +183,8 @@ UI_KEY_STORE_PASSWORD=Key store password:
UI_KEY_STORE_PASSWORD_HELP=Key store password
UI_KEY_STORE_TYPE=Key store type:
UI_KEY_STORE_TYPE_HELP=Choose key store type
UI_CLIENT_SO_TIMEOUT=Client connection timeout:
UI_CLIENT_SO_TIMEOUT_HELP=Client connection timeout in seconds, 0 to disable timeout, empty for 5 minutes
UI_CLIENT_KEY_STORE=Client key store:
UI_CLIENT_KEY_STORE_HELP=SSL client certificate key store file path
UI_CLIENT_KEY_STORE_PASSWORD=Client key store password:

View File

@ -218,6 +218,8 @@ UI_PKCS11_LIBRARY_HELP=Chemin de la librarie PKCS11 (carte
UI_PKCS11_LIBRARY=Librairie PKCS11 :
UI_PKCS11_CONFIG_HELP=Configuration PKCS11 complémentaire optionnelle (slot, nssArgs, ...)
UI_PKCS11_CONFIG=Configuration PKCS11 :
UI_CLIENT_SO_TIMEOUT=Délai d'attente client:
UI_CLIENT_SO_TIMEOUT_HELP=Délai d'attente client en secondes, 0 pour désactiver, vide pour 5 minutes
UI_CLIENT_CERTIFICATE=Certificat client (DavMail vers Exchange)
UI_LOG_FILE_PATH=Chemin du fichier de traces :
UI_LOG_FILE_SIZE=Taille du fichier de traces :

View File

@ -68,6 +68,11 @@
</td>
<td>10.0.1.2</td>
</tr>
<tr>
<td>Client connection timeout</td>
<td>Client connection timeout in seconds, 0 to disable timeout, empty for 5 minutes</td>
<td>300</td>
</tr>
</table>
</subsection>
<subsection name="Encryption">

View File

@ -53,6 +53,7 @@ davmail.smtpSaveInSent=true
davmail.server=true
davmail.server.certificate.hash=
davmail.bindAddress=
davmail.clientSoTimeout=
davmail.allowRemote=true
davmail.disableUpdateCheck=false
log4j.rootLogger=WARN