Allow more then one user server in the user server config of the

message server. This is needed for larger grids
0.6.1-post-fixes
Melanie Thielker 2008-11-17 03:28:38 +00:00
parent 0e7b6879d2
commit 840ef17b8d
1 changed files with 43 additions and 25 deletions

View File

@ -518,22 +518,32 @@ namespace OpenSim.Grid.MessagingServer
ArrayList SendParams = new ArrayList(); ArrayList SendParams = new ArrayList();
SendParams.Add(UserParams); SendParams.Add(UserParams);
// Send Request bool success = true;
try string[] servers = m_cfg.UserServerURL.Split(' ');
{
XmlRpcRequest UserReq = new XmlRpcRequest("register_messageserver", SendParams);
XmlRpcResponse UserResp = UserReq.Send(m_cfg.UserServerURL, 16000);
// Process Response foreach (string srv in servers)
Hashtable GridRespData = (Hashtable)UserResp.Value;
// if we got a response, we were successful
return GridRespData.ContainsKey("responsestring");
}
catch (Exception ex)
{ {
m_log.Error("Unable to connect to grid. User server not running?"); // Send Request
throw(ex); 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() public bool deregisterWithUserServer()
@ -557,21 +567,29 @@ namespace OpenSim.Grid.MessagingServer
ArrayList SendParams = new ArrayList(); ArrayList SendParams = new ArrayList();
SendParams.Add(UserParams); SendParams.Add(UserParams);
bool success = true;
string[] servers = m_cfg.UserServerURL.Split(' ');
// Send Request // Send Request
try foreach (string srv in servers)
{ {
XmlRpcRequest UserReq = new XmlRpcRequest("deregister_messageserver", SendParams); try
XmlRpcResponse UserResp = UserReq.Send(m_cfg.UserServerURL, 16000); {
// Process Response XmlRpcRequest UserReq = new XmlRpcRequest("deregister_messageserver", SendParams);
Hashtable UserRespData = (Hashtable)UserResp.Value; XmlRpcResponse UserResp = UserReq.Send(m_cfg.UserServerURL, 16000);
// if we got a response, we were successful // Process Response
return UserRespData.ContainsKey("responsestring"); Hashtable UserRespData = (Hashtable)UserResp.Value;
} // if we got a response, we were successful
catch (Exception ex) if(!UserRespData.ContainsKey("responsestring"))
{ success = false;
m_log.Error("Unable to connect to grid. User server not running?"); }
throw (ex); catch (Exception ex)
{
m_log.Error("Unable to connect to grid. User server not running?");
success = false;
}
} }
return success;
} }
#endregion #endregion