From 840ef17b8d8f6d7b91b45c239dfa400a06dd5388 Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Mon, 17 Nov 2008 03:28:38 +0000 Subject: Allow more then one user server in the user server config of the message server. This is needed for larger grids --- OpenSim/Grid/MessagingServer/MessageService.cs | 68 ++++++++++++++++---------- 1 file changed, 43 insertions(+), 25 deletions(-) (limited to 'OpenSim/Grid/MessagingServer') diff --git a/OpenSim/Grid/MessagingServer/MessageService.cs b/OpenSim/Grid/MessagingServer/MessageService.cs index 0be58e3..5841672 100644 --- a/OpenSim/Grid/MessagingServer/MessageService.cs +++ b/OpenSim/Grid/MessagingServer/MessageService.cs @@ -518,22 +518,32 @@ namespace OpenSim.Grid.MessagingServer ArrayList SendParams = new ArrayList(); SendParams.Add(UserParams); - // Send Request - try - { - XmlRpcRequest UserReq = new XmlRpcRequest("register_messageserver", SendParams); - XmlRpcResponse UserResp = UserReq.Send(m_cfg.UserServerURL, 16000); + bool success = true; + string[] servers = m_cfg.UserServerURL.Split(' '); - // Process Response - Hashtable GridRespData = (Hashtable)UserResp.Value; - // if we got a response, we were successful - return GridRespData.ContainsKey("responsestring"); - } - catch (Exception ex) + foreach (string srv in servers) { - m_log.Error("Unable to connect to grid. User server not running?"); - throw(ex); + // Send Request + try + { + XmlRpcRequest UserReq = new XmlRpcRequest("register_messageserver", SendParams); + XmlRpcResponse UserResp = UserReq.Send(srv, 16000); + + // Process Response + Hashtable GridRespData = (Hashtable)UserResp.Value; + // if we got a response, we were successful + if (!GridRespData.ContainsKey("responsestring")) + success = false; + else + m_log.InfoFormat("[SERVER] Registered with {0}", srv); + } + catch (Exception ex) + { + m_log.ErrorFormat("Unable to connect to server {0}. Server not running?", srv); + success = false; + } } + return success; } public bool deregisterWithUserServer() @@ -557,21 +567,29 @@ namespace OpenSim.Grid.MessagingServer ArrayList SendParams = new ArrayList(); SendParams.Add(UserParams); + bool success = true; + string[] servers = m_cfg.UserServerURL.Split(' '); + // Send Request - try - { - XmlRpcRequest UserReq = new XmlRpcRequest("deregister_messageserver", SendParams); - XmlRpcResponse UserResp = UserReq.Send(m_cfg.UserServerURL, 16000); - // Process Response - Hashtable UserRespData = (Hashtable)UserResp.Value; - // if we got a response, we were successful - return UserRespData.ContainsKey("responsestring"); - } - catch (Exception ex) + foreach (string srv in servers) { - m_log.Error("Unable to connect to grid. User server not running?"); - throw (ex); + try + { + XmlRpcRequest UserReq = new XmlRpcRequest("deregister_messageserver", SendParams); + XmlRpcResponse UserResp = UserReq.Send(m_cfg.UserServerURL, 16000); + // Process Response + Hashtable UserRespData = (Hashtable)UserResp.Value; + // if we got a response, we were successful + if(!UserRespData.ContainsKey("responsestring")) + success = false; + } + catch (Exception ex) + { + m_log.Error("Unable to connect to grid. User server not running?"); + success = false; + } } + return success; } #endregion -- cgit v1.1