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,23 +518,33 @@ 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(' ');
foreach (string srv in servers)
{
// Send Request // Send Request
try try
{ {
XmlRpcRequest UserReq = new XmlRpcRequest("register_messageserver", SendParams); XmlRpcRequest UserReq = new XmlRpcRequest("register_messageserver", SendParams);
XmlRpcResponse UserResp = UserReq.Send(m_cfg.UserServerURL, 16000); XmlRpcResponse UserResp = UserReq.Send(srv, 16000);
// Process Response // Process Response
Hashtable GridRespData = (Hashtable)UserResp.Value; Hashtable GridRespData = (Hashtable)UserResp.Value;
// if we got a response, we were successful // if we got a response, we were successful
return GridRespData.ContainsKey("responsestring"); if (!GridRespData.ContainsKey("responsestring"))
success = false;
else
m_log.InfoFormat("[SERVER] Registered with {0}", srv);
} }
catch (Exception ex) catch (Exception ex)
{ {
m_log.Error("Unable to connect to grid. User server not running?"); m_log.ErrorFormat("Unable to connect to server {0}. Server not running?", srv);
throw(ex); success = false;
} }
} }
return success;
}
public bool deregisterWithUserServer() public bool deregisterWithUserServer()
{ {
@ -557,7 +567,12 @@ 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
foreach (string srv in servers)
{
try try
{ {
XmlRpcRequest UserReq = new XmlRpcRequest("deregister_messageserver", SendParams); XmlRpcRequest UserReq = new XmlRpcRequest("deregister_messageserver", SendParams);
@ -565,14 +580,17 @@ namespace OpenSim.Grid.MessagingServer
// Process Response // Process Response
Hashtable UserRespData = (Hashtable)UserResp.Value; Hashtable UserRespData = (Hashtable)UserResp.Value;
// if we got a response, we were successful // if we got a response, we were successful
return UserRespData.ContainsKey("responsestring"); if(!UserRespData.ContainsKey("responsestring"))
success = false;
} }
catch (Exception ex) catch (Exception ex)
{ {
m_log.Error("Unable to connect to grid. User server not running?"); m_log.Error("Unable to connect to grid. User server not running?");
throw (ex); success = false;
} }
} }
return success;
}
#endregion #endregion
} }