Home | Trees | Indices | Help |
|
---|
|
Represents a client connected to the bus. Every callback methods registered by an agent receive an object of this type as their first parameter, so that they know which agent on the bus is the cause of the event which triggered the callback.
An IvyClient is responsible for:
- managing the remote agent's subscriptions,
- sending messages to the remote agent.
It is not responsible for receiving messages from the client: another object is in charge of that, namely an IvyHandler object.
The local IvyServer creates one IvyClient per agent on the bus.
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
Protocol-related methods | |||
---|---|---|---|
|
|||
|
|||
|
|||
|
|||
|
|||
Manipulating the remote agent's subscriptions | |||
|
|||
|
|||
Sending messages | |||
|
|||
|
|||
|
|
|||
agent_id = None
|
|||
agent_name = None
|
|||
port = None
|
|||
socket = None
|
|
|||
threading.Lock
|
regexp_lock a non-reentrant lock protecting the variable regexps. |
||
regexps a dictionary mapping subscriptions' ids (as delivered by add_regexp) to the corresponding regular expressions. |
|
|
|
|
|
|
Sends a direct message Note: the message will be encoded by encode_message with
numerical_id=num_id and params==msg; this means that if typedef void (*MsgDirectCallback)( IvyClientPtr app, void *user_data, int id, char *msg ) ; |
|
|
|
Internally used to send message to the remote agent through the opened
socket self.socket. This method catches all exceptions
The errors that can occur are for example: socket.timeout: timed out socket.error: (104, 'Connection reset by peer') socket.error: (32, 'Broken pipe') They can happen after a client disconnects abruptly (because it was killed, because the network is down, etc.). We assume here that if and when an error happens here, a disconnection will be detected shortly afterwards by the server which then removes this agent from the bus. Hence, we ognore the error; please also note that not ignoring the error can have an impact on code, for example, IyServer.send_msg() does not expect that IvyClient.send() fails and if it fails, it is possible that the server does not send the message to all possible subscribers. Note ivysocket.c:SocketSendRaw() also ignores error, simply logging them. |
|
regexp_locka non-reentrant lock protecting the variable regexps. Used by methods add_regexp, remove_regexp and send_msg.
|
regexpsa dictionary mapping subscriptions' ids (as delivered by add_regexp) to the corresponding regular expressions. Precisely, it maps ids to tuples being (regexp_as_string, compiled_regexp). You shouldn't directly access or manipulate this variable, use add_regexp and remove_regexp instead; however if you really need/want to, you must acquire the regexp_lock before accessing/modifying it. |
Home | Trees | Indices | Help |
|
---|
Generated by Epydoc 3.0.1 on Tue Jun 10 18:21:20 2008 | http://epydoc.sourceforge.net |