OLD | NEW |
1 """TLS Lite + asyncore.""" | 1 """TLS Lite + asyncore.""" |
2 | 2 |
3 | 3 |
4 import asyncore | 4 import asyncore |
5 from tlslite.TLSConnection import TLSConnection | 5 from tlslite.tlsconnection import TLSConnection |
6 from AsyncStateMachine import AsyncStateMachine | 6 from asyncstatemachine import AsyncStateMachine |
7 | 7 |
8 | 8 |
9 class TLSAsyncDispatcherMixIn(AsyncStateMachine): | 9 class TLSAsyncDispatcherMixIn(AsyncStateMachine): |
10 """This class can be "mixed in" with an | 10 """This class can be "mixed in" with an |
11 L{asyncore.dispatcher} to add TLS support. | 11 L{asyncore.dispatcher} to add TLS support. |
12 | 12 |
13 This class essentially sits between the dispatcher and the select | 13 This class essentially sits between the dispatcher and the select |
14 loop, intercepting events and only calling the dispatcher when | 14 loop, intercepting events and only calling the dispatcher when |
15 applicable. | 15 applicable. |
16 | 16 |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
129 return returnValue | 129 return returnValue |
130 | 130 |
131 def send(self, writeBuffer): | 131 def send(self, writeBuffer): |
132 self.setWriteOp(writeBuffer) | 132 self.setWriteOp(writeBuffer) |
133 return len(writeBuffer) | 133 return len(writeBuffer) |
134 | 134 |
135 def close(self): | 135 def close(self): |
136 if hasattr(self, "tlsConnection"): | 136 if hasattr(self, "tlsConnection"): |
137 self.setCloseOp() | 137 self.setCloseOp() |
138 else: | 138 else: |
139 asyncore.dispatcher.close(self) | 139 asyncore.dispatcher.close(self) |
OLD | NEW |