def read_milter_data(self):
""" Callback from asynchat once we have read the milter packet length
worth of bytes on the socket and it is accumulated in our input buffer
(which is the milter command + data to send to the dispatcher). """
import binascii
inbuff = "".join(self.__input)
self.__input = []
if not inbuff.startswith("B"):
if self.chmilt == "Receiver":
logging.debug(' read: %s %s', self.chmilt, binascii.b2a_qp(inbuff))
try:
response = self.__milter_dispatcher.Dispatch(inbuff)
#logging.debug(' >>> resp: [%s]', response)
if type(response) == list:
for r in response:
self.__send_response(r)
elif response:
self.__send_response(response)
# rinse and repeat :)
self.found_terminator = self.read_packetlen
self.set_terminator(MILTER_LEN_BYTES)
except kimpf.PpyMilterCloseConnection, e:
self.close()
#end class ConnectionHandler(asynchat.async_chat).
#end class AsyncPpyMilterServer(asyncore.dispatcher).
#SN July 13, 2015
#Bring configuration processing inside here, instead of in commons.
评论列表
文章目录