Created
July 26, 2012 14:47
-
-
Save sznurek/3182477 to your computer and use it in GitHub Desktop.
First try
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# methods on_read and on_write was called when select confirmed that socket is ready to read from / write to | |
STATE_SEND_LOGIN = 1 | |
STATE_RECEIVE_LOGIN = 2 | |
STATE_SEND_PASS = 3 | |
STATE_RECEIVE_PASS = 4 | |
STATE_SEND_OK = 5 | |
class Authenticator: | |
def __init__(self, sock): | |
self.sock = sock | |
self.state = STATE_SEND_LOGIN | |
def on_read(self): | |
if self.state == ... | |
def on_write(self): | |
if self.state == ... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment