diff --git a/docs/docs/configuration/server.rst b/docs/docs/configuration/server.rst index 13507b7..7d752f0 100644 --- a/docs/docs/configuration/server.rst +++ b/docs/docs/configuration/server.rst @@ -162,6 +162,7 @@ also can moderate (=activate or delete) comments. Don't forget to configure security = starttls to = from = + timeout = 10 username self-explanatory, optional @@ -188,6 +189,10 @@ to from sender address, e.g. isso@example.tld +timeout + specify a timeout in seconds for blocking operations like the + connection attempt. + Guard ----- diff --git a/docs/isso.example.cfg b/docs/isso.example.cfg index a7bedf0..afcfb8b 100644 --- a/docs/isso.example.cfg +++ b/docs/isso.example.cfg @@ -91,6 +91,10 @@ to = # sender address, e.g. isso@example.tld from = +# specify a timeout in seconds for blocking operations like the +# connection attempt. +timeout = 10 + [guard] # Enable basic spam protection features, e.g. rate-limit per IP address (/24 for diff --git a/isso/core.py b/isso/core.py index ce2abf2..315a364 100644 --- a/isso/core.py +++ b/isso/core.py @@ -128,6 +128,7 @@ class Config: "username = ", "password = ", "host = localhost", "port = 587", "security = starttls", "to = ", "from = ", + "timeout = 10", "[guard]", "enabled = true", "ratelimit = 2", diff --git a/isso/ext/notifications.py b/isso/ext/notifications.py index ef9459a..72fe16e 100644 --- a/isso/ext/notifications.py +++ b/isso/ext/notifications.py @@ -60,7 +60,7 @@ class SMTP(object): klass = (smtplib.SMTP_SSL if self.conf.get('security') == 'ssl' else smtplib.SMTP) self.client = klass(host=self.conf.get('host'), port=self.conf.getint('port'), - timeout=5) + timeout=self.conf.getint('timeout')) if self.conf.get('security') == 'starttls': self.client.starttls();