add printlocks
This commit is contained in:
parent
6eea004723
commit
295341a9dd
|
@ -295,6 +295,7 @@ class bitmessagePOP3Server(asyncore.dispatcher):
|
|||
@staticmethod
|
||||
def reformatMessageForReceipt(toAddress, fromAddress, body, subject):
|
||||
message = parser.Parser().parsestr(body)
|
||||
with shared.printLock:
|
||||
print(message)
|
||||
|
||||
subject_is_valid = False
|
||||
|
@ -392,6 +393,7 @@ class bitmessagePOP3Server(asyncore.dispatcher):
|
|||
@staticmethod
|
||||
def reformatMessageForMailingList(toAddress, fromAddress, body, subject, mailingListName):
|
||||
message = parser.Parser().parsestr(body)
|
||||
with shared.printLock:
|
||||
print(message)
|
||||
|
||||
subject_is_valid = False
|
||||
|
|
|
@ -42,6 +42,7 @@ class bitmessageSMTPChannel(asynchat.async_chat):
|
|||
if err[0] != errno.ENOTCONN:
|
||||
raise
|
||||
return
|
||||
with shared.printLock:
|
||||
print >> smtpd.DEBUGSTREAM, 'Peer:', repr(self.__peer)
|
||||
self.push('220 %s %s' % (self.__fqdn, self.__version))
|
||||
self.set_terminator('\r\n')
|
||||
|
@ -66,6 +67,7 @@ class bitmessageSMTPChannel(asynchat.async_chat):
|
|||
# Implementation of base class abstract method
|
||||
def found_terminator(self):
|
||||
line = ''.join(self.__line)
|
||||
with shared.printLock:
|
||||
print >> smtpd.DEBUGSTREAM, 'Data:', repr(line)
|
||||
self.__line = []
|
||||
if self.__state == self.COMMAND:
|
||||
|
@ -236,6 +238,7 @@ class bitmessageSMTPChannel(asynchat.async_chat):
|
|||
return address
|
||||
|
||||
def smtp_MAIL(self, arg):
|
||||
with shared.printLock:
|
||||
print >> smtpd.DEBUGSTREAM, '===> MAIL', arg
|
||||
|
||||
address = self.__getaddr('FROM:', arg) if arg else None
|
||||
|
@ -256,10 +259,12 @@ class bitmessageSMTPChannel(asynchat.async_chat):
|
|||
return
|
||||
|
||||
self.__mailfrom = address
|
||||
with shared.printLock:
|
||||
print >> smtpd.DEBUGSTREAM, 'sender:', self.__mailfrom
|
||||
self.push('250 Ok')
|
||||
|
||||
def smtp_RCPT(self, arg):
|
||||
with shared.printLock:
|
||||
print >> smtpd.DEBUGSTREAM, '===> RCPT', arg
|
||||
if not self.__mailfrom:
|
||||
self.invalid_command('503 Error: need MAIL command')
|
||||
|
@ -279,6 +284,7 @@ class bitmessageSMTPChannel(asynchat.async_chat):
|
|||
return
|
||||
realAddress = applyBase58Capitalization(address, int(capitalization))
|
||||
self.__rcpttos.append('{}@{}'.format(getBase58Capitaliation(realAddress), realAddress))
|
||||
with shared.printLock:
|
||||
print >> smtpd.DEBUGSTREAM, 'recips:', self.__rcpttos
|
||||
self.push('250 Ok')
|
||||
|
||||
|
@ -347,7 +353,6 @@ class bitmessageSMTPServer(smtpd.SMTPServer):
|
|||
headersToStrip = "Message-ID, User-Agent"
|
||||
|
||||
headersToStrip = [x.strip() for x in headersToStrip.split(',') if len(x.strip()) > 0]
|
||||
print(headersToStrip)
|
||||
for h in headersToStrip:
|
||||
if h in message:
|
||||
del message[h]
|
||||
|
@ -369,6 +374,7 @@ class bitmessageSMTPServer(smtpd.SMTPServer):
|
|||
gen = generator.Generator(fp, mangle_from_=False, maxheaderlen=128)
|
||||
gen.flatten(message)
|
||||
message_as_text = fp.getvalue()
|
||||
with shared.printLink:
|
||||
print(message_as_text)
|
||||
|
||||
checksum = hashlib.sha256(message_as_text).digest()[:2]
|
||||
|
|
Reference in New Issue
Block a user