Methods

Class: Operation

Methods

__init__ (self, sock, timeout=None, weak_timeout=True, prio=-1)

All the socket operations have these generic properties that the poller and scheduler interprets:

  • timeout - the ammout of time in seconds or timedelta, or the datetime value till the poller should wait for this operation.
  • weak_timeout - if this is True the timeout handling code will take into account the time of last activity (that would be the time of last try_run call)
  • prio - a flag for the scheduler

try_run (self)

This method will return a None value or raise a exception if the operation can'self complete at this time.

The socket poller will run this method if the socket is readable/writeable.

If this returns a value that evaluates to False, the poller will try to run this at a later time (when the socket is readable/writeable again).