def __init__(self, isServer, ipAddr, port, factory, queue, incomingDataThread, callbackObject): """ Initializes the connection. Args: isServer: True when this is a server connection or False otherwise. ipAddr: the server's IP address port: the port assigned to the connection. factory: the protocol factory assigned to the connnection queue: the incoming data queue assigned to the connection incomingDataThread: the incoming data thread assigned to the connection callbackObject: the callback object assigned to the connection """ self.__status = _ConnectionStatus(CONNECTION_STATUS.OPENING) self.__isServer = isServer self.__ipAddr = ipAddr self.__port = port self.__factory = factory self.__queue = queue self.__incomingDataThread = incomingDataThread self.__callback = callbackObject self.__packagesToSend = MultithreadingCounter() self.__deferred = None self.__listeningPort = None self.__unexpectedlyClosed = False self.__error = None
def __init__(self, queue, callbackObject): """ Initializes the thread's state Args: queue: The incoming packages queue callbackObject: The callback object that will process all the received packets. """ QueueProcessingThread.__init__(self, "Incoming data processing thread", queue) self.__callbackObject = callbackObject self.__referenceCounter = MultithreadingCounter()