Don't send unnecessary ACKs

In some situations, it's not necessary to send an ACK. For example, when
the sender is blacklisted, when the message has no content, or when the
address has ACK sending disabled.

Also it's not necessary to rebroadcast empty messages into a mailing
list.
This commit is contained in:
Peter Šurda 2016-02-12 23:35:28 +01:00
parent 0db41adfd7
commit 2f6c36cab2
Signed by untrusted user: PeterSurda
GPG Key ID: 0C5F50C0B5F37D87

View File

@ -524,7 +524,7 @@ class objectProcessor(threading.Thread):
# Let us now check and see whether our receiving address is # Let us now check and see whether our receiving address is
# behaving as a mailing list # behaving as a mailing list
if shared.safeConfigGetBoolean(toAddress, 'mailinglist'): if shared.safeConfigGetBoolean(toAddress, 'mailinglist') and messageEncodingType != 0:
try: try:
mailingListName = shared.config.get( mailingListName = shared.config.get(
toAddress, 'mailinglistname') toAddress, 'mailinglistname')
@ -567,7 +567,11 @@ class objectProcessor(threading.Thread):
toAddress, '[Broadcast subscribers]', fromAddress, subject, message, ackdataForBroadcast))) toAddress, '[Broadcast subscribers]', fromAddress, subject, message, ackdataForBroadcast)))
shared.workerQueue.put(('sendbroadcast', '')) shared.workerQueue.put(('sendbroadcast', ''))
if self.ackDataHasAVaildHeader(ackData): # Don't send ACK if invalid, blacklisted senders, invisible messages or disabled
if self.ackDataHasAValidHeader(ackData) and \
not blockMessage and \
messageEncodingType != 0 and \
not shared.safeConfigGetBoolean(toAddress, 'dontsendack'):
shared.checkAndShareObjectWithPeers(ackData[24:]) shared.checkAndShareObjectWithPeers(ackData[24:])
# Display timing data # Display timing data
@ -814,7 +818,7 @@ class objectProcessor(threading.Thread):
address) address)
shared.workerQueue.put(('sendmessage', '')) shared.workerQueue.put(('sendmessage', ''))
def ackDataHasAVaildHeader(self, ackData): def ackDataHasAValidHeader(self, ackData):
if len(ackData) < shared.Header.size: if len(ackData) < shared.Header.size:
logger.info('The length of ackData is unreasonably short. Not sending ackData.') logger.info('The length of ackData is unreasonably short. Not sending ackData.')
return False return False