From 2f6c36cab24416385b7928e6dad3c6312aea21c8 Mon Sep 17 00:00:00 2001 From: Peter Surda Date: Fri, 12 Feb 2016 23:35:28 +0100 Subject: [PATCH] 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. --- src/class_objectProcessor.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/class_objectProcessor.py b/src/class_objectProcessor.py index 0035dce9..ca96a609 100644 --- a/src/class_objectProcessor.py +++ b/src/class_objectProcessor.py @@ -524,7 +524,7 @@ class objectProcessor(threading.Thread): # Let us now check and see whether our receiving address is # behaving as a mailing list - if shared.safeConfigGetBoolean(toAddress, 'mailinglist'): + if shared.safeConfigGetBoolean(toAddress, 'mailinglist') and messageEncodingType != 0: try: mailingListName = shared.config.get( toAddress, 'mailinglistname') @@ -567,7 +567,11 @@ class objectProcessor(threading.Thread): toAddress, '[Broadcast subscribers]', fromAddress, subject, message, ackdataForBroadcast))) 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:]) # Display timing data @@ -814,7 +818,7 @@ class objectProcessor(threading.Thread): address) shared.workerQueue.put(('sendmessage', '')) - def ackDataHasAVaildHeader(self, ackData): + def ackDataHasAValidHeader(self, ackData): if len(ackData) < shared.Header.size: logger.info('The length of ackData is unreasonably short. Not sending ackData.') return False