Beispiel #1
0
 def close(self):
     """
     @summary:  Close raw layer
                 Use File descriptor directly to not use TLS close
                 Because is bugged
     """
     FileDescriptor.loseConnection(self.getDescriptor())
Beispiel #2
0
 def close(self):
     """
     @summary:  Close raw layer
                 Use File descriptor directly to not use TLS close
                 Because is bugged
     """
     FileDescriptor.loseConnection(self.transport)
Beispiel #3
0
    def loseConnection(self):
        """
        Close this connection after writing all pending data.

        If TLS has been negotiated, perform a TLS shutdown.
        """
        if self.TLS:
            if self.connected and not self.disconnecting:
                self.protocol.loseConnection()
        else:
            FileDescriptor.loseConnection(self)
Beispiel #4
0
    def loseConnection(self):
        """
        Close this connection after writing all pending data.

        If TLS has been negotiated, perform a TLS shutdown.
        """
        if self.TLS:
            if self.connected and not self.disconnecting:
                self.protocol.loseConnection()
        else:
            FileDescriptor.loseConnection(self)
Beispiel #5
0
 def dataReceived(self, data):
     """
     @summary:  Inherit from twisted.protocol class
                 main event of received data
     @param data: string data receive from twisted
     """
     #add in buffer
     if data:
         self._buffer += data
     else:
         FileDescriptor.loseConnection(self.getDescriptor())
     #while buffer have expected size call local callback
     while self._expectedLen > 0 and len(self._buffer) >= self._expectedLen:
         #expected data is first expected bytes
         expectedData = Stream(self._buffer[0:self._expectedLen])
         #rest is for next event of automata
         self._buffer = self._buffer[self._expectedLen:]
         #call recv function
         self.recv(expectedData)