Example #1
0
 def writeSequence(self, seq):
     if not self.tlsStarted:
         ProtocolWrapper.writeSequence(self, seq)
     else:
         #Because of the FakeSocket, write operations are guaranteed to
         #terminate immediately.
         AsyncStateMachine.setWriteOp(self, "".join(seq))
Example #2
0
 def __init__(self, factory, wrappedProtocol):
     ProtocolWrapper.__init__(self, factory, wrappedProtocol)
     AsyncStateMachine.__init__(self)
     self.fakeSocket = _FakeSocket(self)
     self.tlsConnection = TLSConnection(self.fakeSocket)
     self.tlsStarted = False
     self.connectionLostCalled = False
Example #3
0
 def dataReceived(self, data):
     try:
         if not self.tlsStarted:
             ProtocolWrapper.dataReceived(self, data)
         else:
             self.fakeSocket.data += data
             while self.fakeSocket.data:
                 AsyncStateMachine.inReadEvent(self)
     except TLSError, e:
         self.connectionLost(Failure(e))
         ProtocolWrapper.loseConnection(self)
Example #4
0
    def __init__(self, sock=None):
        AsyncStateMachine.__init__(self)

        if sock:
            self.tlsConnection = TLSConnection(sock)

        #Calculate the sibling I'm being mixed in with.
        #This is necessary since we override functions
        #like readable(), handle_read(), etc., but we
        #also want to call the sibling's versions.
        for cl in self.__class__.__bases__:
            if cl != TLSAsyncDispatcherMixIn and cl != AsyncStateMachine:
                self.siblingClass = cl
                break
        else:
            raise AssertionError()
    def __init__(self, sock=None):
        AsyncStateMachine.__init__(self)

        if sock:
            self.tlsConnection = TLSConnection(sock)

        #Calculate the sibling I'm being mixed in with.
        #This is necessary since we override functions
        #like readable(), handle_read(), etc., but we
        #also want to call the sibling's versions.
        for cl in self.__class__.__bases__:
            if cl != TLSAsyncDispatcherMixIn and cl != AsyncStateMachine:
                self.siblingClass = cl
                break
        else:
            raise AssertionError()
Example #6
0
 def loseConnection(self):
     if not self.tlsStarted:
         ProtocolWrapper.loseConnection(self)
     else:
         AsyncStateMachine.setCloseOp(self)
Example #7
0
 def setServerHandshakeOp(self, **args):
     self.tlsStarted = True
     AsyncStateMachine.setServerHandshakeOp(self, **args)