def startTLS(self, ctx, normal=True): """ @see: L{ITLSTransport.startTLS} """ if self.dataBuffer or self._tempDataBuffer: # pre-TLS bytes are still being written. Starting TLS now # will do the wrong thing. Instead, mark that we're trying # to go into the TLS state. self._tlsWaiting = _TLSDelayed([], ctx, normal) return False startTLS(self, ctx, normal, FileDescriptor)
def startTLS(self, ctx, extra=True): assert not self.TLS if self.dataBuffer or self._tempDataBuffer: # pre-TLS bytes are still being written. Starting TLS now # will do the wrong thing. Instead, mark that we're trying # to go into the TLS state. self._tlsWaiting = _TLSDelayed([], ctx, extra) return False self.stopReading() self.stopWriting() self._startTLS() self.socket = SSL.Connection(ctx.getContext(), self.socket) self.fileno = self.socket.fileno self.startReading() return True