diff options
author | Kali Kaneko <kali@leap.se> | 2015-09-21 16:37:25 -0400 |
---|---|---|
committer | Kali Kaneko <kali@leap.se> | 2015-09-21 16:37:31 -0400 |
commit | 36966a403237307a68359cac97a718462b2e02e3 (patch) | |
tree | 9d364265566a3b29e09ebdfa261cd93b06c9d24c /src/leap/mail/incoming/service.py | |
parent | 9f3d6812da3b361886cbca421c0f9d050eba3ac5 (diff) |
[doc] document return values
Diffstat (limited to 'src/leap/mail/incoming/service.py')
-rw-r--r-- | src/leap/mail/incoming/service.py | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/leap/mail/incoming/service.py b/src/leap/mail/incoming/service.py index c98e639..ec85eed 100644 --- a/src/leap/mail/incoming/service.py +++ b/src/leap/mail/incoming/service.py @@ -32,6 +32,7 @@ from urlparse import urlparse from twisted.application.service import Service from twisted.python import log +from twisted.python.failure import Failure from twisted.internet import defer, reactor from twisted.internet.task import LoopingCall from twisted.internet.task import deferLater @@ -183,13 +184,21 @@ class IncomingMail(Service): def startService(self): """ Starts a loop to fetch mail. + + :returns: A Deferred whose callback will be invoked with + the LoopingCall instance when loop.stop is called, or + whose errback will be invoked when the function raises an + exception or returned a deferred that has its errback + invoked. """ Service.startService(self) if self._loop is None: self._loop = LoopingCall(self.fetch) - return self._loop.start(self._check_period) + stop_deferred = self._loop.start(self._check_period) + return stop_deferred else: logger.warning("Tried to start an already running fetching loop.") + return defer.fail(Failure('Already running loop.')) def stopService(self): """ |