summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKali Kaneko <kali@leap.se>2014-01-21 01:04:37 -0400
committerKali Kaneko <kali@leap.se>2014-01-21 12:20:06 -0400
commitf0fabcfd19702c98636e039bcd1ac7a7e37ad727 (patch)
tree0ea75ff6861e51ee69cb6a4585a158663d02c470
parent2545c11a4d11971a9e9384c7e560946fda65973b (diff)
workaround for recursionlimit due to qtreactor
-rw-r--r--mail/src/leap/mail/imap/mailbox.py4
-rw-r--r--mail/src/leap/mail/imap/messages.py2
-rw-r--r--mail/src/leap/mail/imap/service/imap.py23
3 files changed, 23 insertions, 6 deletions
diff --git a/mail/src/leap/mail/imap/mailbox.py b/mail/src/leap/mail/imap/mailbox.py
index 174361f..38c58cb 100644
--- a/mail/src/leap/mail/imap/mailbox.py
+++ b/mail/src/leap/mail/imap/mailbox.py
@@ -765,6 +765,10 @@ class SoledadMailbox(WithMsgFields, MBoxParser):
uid_next = self.getUIDNext()
msg = messageObject
+ # XXX DEBUG ----------------------------------------
+ #print "copying MESSAGE from %s (%s) to %s (%s)" % (
+ #msg._mbox, msg._uid, self.mbox, uid_next)
+
# XXX should use a public api instead
fdoc = msg._fdoc
if not fdoc:
diff --git a/mail/src/leap/mail/imap/messages.py b/mail/src/leap/mail/imap/messages.py
index 378738e..cd4d85f 100644
--- a/mail/src/leap/mail/imap/messages.py
+++ b/mail/src/leap/mail/imap/messages.py
@@ -528,7 +528,6 @@ class LeapMessage(fields, MailParser, MBoxParser):
body = self._bdoc.content.get(self.RAW_KEY, "")
content_type = bdoc.content.get('content-type', "")
charset = first(CHARSET_RE.findall(content_type))
- logger.debug("Got charset from header: %s" % (charset,))
if not charset:
charset = self._get_charset(body)
try:
@@ -665,7 +664,6 @@ class LeapMessage(fields, MailParser, MBoxParser):
try:
pmap_dict = self._get_part_from_parts_map(part + 1)
except KeyError:
- logger.debug("getSubpart for %s: KeyError" % (part,))
raise IndexError
return MessagePart(self._soledad, pmap_dict)
diff --git a/mail/src/leap/mail/imap/service/imap.py b/mail/src/leap/mail/imap/service/imap.py
index a1d3ab7..ad22da6 100644
--- a/mail/src/leap/mail/imap/service/imap.py
+++ b/mail/src/leap/mail/imap/service/imap.py
@@ -49,6 +49,25 @@ from leap.common.events.events_pb2 import IMAP_SERVICE_STARTED
from leap.common.events.events_pb2 import IMAP_SERVICE_FAILED_TO_START
from leap.common.events.events_pb2 import IMAP_CLIENT_LOGIN
+######################################################
+# Temporary workaround for RecursionLimit when using
+# qt4reactor. Do remove when we move to poll or select
+# reactor, which do not show those problems. See #4974
+import resource
+import sys
+
+try:
+ sys.setrecursionlimit(10**6)
+except Exception:
+ print "Error setting recursion limit"
+try:
+ # Increase max stack size from 8MB to 256MB
+ resource.setrlimit(resource.RLIMIT_STACK, (2**28, -1))
+except Exception:
+ print "Error setting stack size"
+
+######################################################
+
class LeapIMAPServer(imap4.IMAP4Server):
"""
@@ -118,14 +137,10 @@ class LeapIMAPServer(imap4.IMAP4Server):
method
"""
from twisted.internet import reactor
- log.msg("LEAP Overwritten fetch...")
if not query:
self.sendPositiveResponse(tag, 'FETCH complete')
return # XXX ???
- print "QUERY ", query
- print query[0]
-
cbFetch = self._IMAP4Server__cbFetch
ebFetch = self._IMAP4Server__ebFetch