nbxmpp.idlequeue.IdleQueue

Package nbxmpp :: Module idlequeue :: Class IdleQueue |
[hide private]
[frames] | no frames]

# Class IdleQueue

source code

IdleQueue provide three distinct time based features. Uses select.poll()

> 1. Alarm timeout: Execute a callback after foo seconds
> 2. Timeout event: Call read_timeout() of an plugged object if a timeout has been set, but not removed in time.
> 3. Check file descriptor of plugged objects for read, write and error events

Instance Methods | [hide private]
__init__(self) | source code
_init_idle(self) Hook method for subclassed. Will be called by __init__ | source code
set_alarm(self, alarm_cb, seconds) Set up a new alarm. alarm_cb will be called after specified seconds. | source code
remove_alarm(self, alarm_cb, alarm_time) Remove alarm callback alarm_cb scheduled on alarm_time. Returns True if it was removed sucessfully, otherwise False | source code
remove_timeout(self, fd, timeout=None) Remove the read timeout | source code
set_read_timeout(self, fd, seconds, func=None) Seta a new timeout. If it is not removed after specified seconds, func or obj.read_timeout() will be called | source code
_check_time_events(self) Execute and remove alarm callbacks and execute func() or read_timeout() for plugged objects if specified time has ellapsed | source code
plug_idle(self, obj, writable=True, readable=True) Plug an IdleObject into idlequeue. Filedescriptor fd must be set | source code
_add_idle(self, fd, flags) Hook method for subclasses, called by plug_idle | source code
unplug_idle(self, fd) Remove plugged IdleObject, specified by filedescriptor fd | source code
current_time(self) | source code
_remove_idle(self, fd) Hook method for subclassed, called by unplug_idle | source code
_process_events(self, fd, flags) | source code
process(self) Process idlequeue. Check for any pending timeout or alarm events. Call IdleObjects on possible and requested read, write and error events on their file descriptors | source code

Class Variables | [hide private]
| PROCESS_TIMEOUT = ``(`100`,` False`)``

Method Details | [hide private]

### __init__(self) (Constructor) | source code

### _init_idle(self) | source code
Hook method for subclassed. Will be called by __init__

### set_alarm(self, alarm_cb, seconds) | source code
Set up a new alarm. alarm_cb will be called after specified seconds.

### remove_alarm(self, alarm_cb, alarm_time) | source code
Remove alarm callback alarm_cb scheduled on alarm_time. Returns True if it was removed sucessfully, otherwise False

### remove_timeout(self, fd, timeout=None) | source code
Remove the read timeout

### set_read_timeout(self, fd, seconds, func=None) | source code
Seta a new timeout. If it is not removed after specified seconds, func or obj.read_timeout() will be called A filedescriptor fd can have several timeouts.

### _check_time_events(self) | source code
Execute and remove alarm callbacks and execute func() or read_timeout() for plugged objects if specified time has ellapsed

### plug_idle(self, obj, writable=True, readable=True) | source code
Plug an IdleObject into idlequeue. Filedescriptor fd must be set Parameters: `obj` - the IdleObject `writable` - True if obj has data to sent `readable` - True if obj expects data to be reiceived

### _add_idle(self, fd, flags) | source code
Hook method for subclasses, called by plug_idle

### unplug_idle(self, fd) | source code
Remove plugged IdleObject, specified by filedescriptor fd

### current_time(self) | source code

### _remove_idle(self, fd) | source code
Hook method for subclassed, called by unplug_idle

### _process_events(self, fd, flags) | source code

### process(self) | source code
Process idlequeue. Check for any pending timeout or alarm events. Call IdleObjects on possible and requested read, write and error events on their file descriptors Call this in regular intervals.

Class Variable Details | [hide private]

  ### PROCESS_TIMEOUT Value:
      (100, False)