MCPcopy Index your code
hub / github.com/python/cpython / _set_state

Method _set_state

Lib/asyncio/sslproto.py:496–532  ·  view source on GitHub ↗
(self, new_state)

Source from the content-addressed store, hash-verified

494 return default
495
496 def _set_state(self, new_state):
497 allowed = False
498
499 if new_state == SSLProtocolState.UNWRAPPED:
500 allowed = True
501
502 elif (
503 self._state == SSLProtocolState.UNWRAPPED and
504 new_state == SSLProtocolState.DO_HANDSHAKE
505 ):
506 allowed = True
507
508 elif (
509 self._state == SSLProtocolState.DO_HANDSHAKE and
510 new_state == SSLProtocolState.WRAPPED
511 ):
512 allowed = True
513
514 elif (
515 self._state == SSLProtocolState.WRAPPED and
516 new_state == SSLProtocolState.FLUSHING
517 ):
518 allowed = True
519
520 elif (
521 self._state == SSLProtocolState.FLUSHING and
522 new_state == SSLProtocolState.SHUTDOWN
523 ):
524 allowed = True
525
526 if allowed:
527 self._state = new_state
528
529 else:
530 raise RuntimeError(
531 'cannot switch state from {} to {}'.format(
532 self._state, new_state))
533
534 # Handshake flow
535

Callers 7

connection_lostMethod · 0.95
eof_receivedMethod · 0.95
_start_handshakeMethod · 0.95
_start_shutdownMethod · 0.95
_do_flushMethod · 0.95
_abortMethod · 0.95

Calls 1

formatMethod · 0.45

Tested by

no test coverage detected