pybitmessage.network.advanceddispatcher module¶
src/network/advanceddispatcher.py¶
-
class
AdvancedDispatcher
(sock=None)[source]¶ Bases:
network.asyncore_pollchoose.dispatcher
Improved version of asyncore dispatcher, with buffers and protocol state.
-
append_write_buf
(data)¶ Append binary data to the end of stream write buffer.
-
handle_close
()¶ Callback for connection being closed, but can also be called directly when you want connection to close.
-
handle_connect
()¶ Method for handling connection established implementations.
-
handle_connect_event
()¶ Callback for connection established event.
-
handle_read
()¶ Append incoming data to the read buffer.
-
handle_write
()¶ Send outgoing data from write buffer.
-
process
()¶ Process (parse) data that’s in the buffer, as long as there is enough data and the connection is open.
-
readable
()¶ Is the read buffer ready to accept data from the network?
-
set_state
(state_str, length=0, expectBytes=0)¶ Set the next processing state.
-
slice_read_buf
(length=0)¶ Cut the beginning of the stream read buffer.
-
slice_write_buf
(length=0)¶ Cut the beginning of the stream write buffer.
-
state_close
()¶ Signal to the processing loop to end.
-
writable
()¶ Is data from the write buffer ready to be sent to the network?
-
-
exception
ProcessingError
[source]¶ Bases:
exceptions.Exception
General class for protocol parser exception, use as a base for others.
-
exception
UnknownStateError
[source]¶ Bases:
pybitmessage.network.advanceddispatcher.ProcessingError
Parser points to an unknown (unimplemented) state.