OLD | NEW |
1 """TLS Lite + Twisted.""" | 1 """TLS Lite + Twisted.""" |
2 | 2 |
3 from twisted.protocols.policies import ProtocolWrapper, WrappingFactory | 3 from twisted.protocols.policies import ProtocolWrapper, WrappingFactory |
4 from twisted.python.failure import Failure | 4 from twisted.python.failure import Failure |
5 | 5 |
6 from AsyncStateMachine import AsyncStateMachine | 6 from asyncstatemachine import AsyncStateMachine |
7 from tlslite.TLSConnection import TLSConnection | 7 from tlslite.tlsconnection import TLSConnection |
8 from tlslite.errors import * | 8 from tlslite.errors import * |
9 | 9 |
10 import socket | 10 import socket |
11 import errno | 11 import errno |
12 | 12 |
13 | 13 |
14 #The TLSConnection is created around a "fake socket" that | 14 #The TLSConnection is created around a "fake socket" that |
15 #plugs it into the underlying Twisted transport | 15 #plugs it into the underlying Twisted transport |
16 class _FakeSocket: | 16 class _FakeSocket: |
17 def __init__(self, wrapper): | 17 def __init__(self, wrapper): |
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
186 #Because of the FakeSocket, write operations are guaranteed to | 186 #Because of the FakeSocket, write operations are guaranteed to |
187 #terminate immediately. | 187 #terminate immediately. |
188 AsyncStateMachine.setWriteOp(self, data) | 188 AsyncStateMachine.setWriteOp(self, data) |
189 | 189 |
190 def writeSequence(self, seq): | 190 def writeSequence(self, seq): |
191 if not self.tlsStarted: | 191 if not self.tlsStarted: |
192 ProtocolWrapper.writeSequence(self, seq) | 192 ProtocolWrapper.writeSequence(self, seq) |
193 else: | 193 else: |
194 #Because of the FakeSocket, write operations are guaranteed to | 194 #Because of the FakeSocket, write operations are guaranteed to |
195 #terminate immediately. | 195 #terminate immediately. |
196 AsyncStateMachine.setWriteOp(self, "".join(seq)) | 196 AsyncStateMachine.setWriteOp(self, "".join(seq)) |
OLD | NEW |