# -----------------------------------------------------------------------
# Go ahead and register the common network objects
# -----------------------------------------------------------------------
-osrf.net_obj.register_hint('osrfMessage', ['threadTrace', 'locale', 'type', 'payload'], 'hash')
+osrf.net_obj.register_hint('osrfMessage', ['threadTrace', 'locale', 'type', 'payload', 'ingress'], 'hash')
osrf.net_obj.register_hint('osrfMethod', ['method', 'params'], 'hash')
osrf.net_obj.register_hint('osrfResult', ['status', 'statusCode', 'content'], 'hash')
osrf.net_obj.register_hint('osrfConnectStatus', ['status', 'statusCode'], 'hash')
''' Global cache of in-service sessions '''
session_cache = {}
+ current_ingress = 'opensrf';
def __init__(self):
# by default, we're connected to no one
return Session.session_cache[thread]
return ServerSession(thread)
+ @staticmethod
+ def ingress(ingress):
+ if ingress:
+ Session.current_ingress = ingress
+ return Session.current_ingress
+
def set_remote_id(self, remoteid):
self.remote_id = remoteid
osrf.log.log_internal("Setting request remote ID to %s" % self.remote_id)
"""Sends an OpenSRF message"""
if not isinstance(omessages, list):
omessages = [omessages]
+
+ for msg in omessages:
+ msg.ingress(Session.current_ingress);
net_msg = osrf.net.NetworkMessage(
recipient = self.remote_id,