本文整理汇总了C#中Nwc.XmlRpc.XmlRpcRequest.Send方法的典型用法代码示例。如果您正苦于以下问题:C# XmlRpcRequest.Send方法的具体用法?C# XmlRpcRequest.Send怎么用?C# XmlRpcRequest.Send使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Nwc.XmlRpc.XmlRpcRequest
的用法示例。
在下文中一共展示了XmlRpcRequest.Send方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CustomiseResponse
public virtual void CustomiseResponse(ref Hashtable response, UserProfile theUser)
{
//default method set up to act as ogs user server
SimProfile SimInfo= new SimProfile();
//get siminfo from grid server
SimInfo = SimInfo.LoadFromGrid(theUser.homeregionhandle, GridURL, GridSendKey, GridRecvKey);
Int32 circode = (Int32)Convert.ToUInt32(response["circuit_code"]);
theUser.AddSimCircuit((uint)circode, SimInfo.UUID);
response["home"] = "{'region_handle':[r" + (SimInfo.RegionLocX * 256).ToString() + ",r" + (SimInfo.RegionLocY * 256).ToString() + "], 'position':[r" + theUser.homepos.X.ToString() + ",r" + theUser.homepos.Y.ToString() + ",r" + theUser.homepos.Z.ToString() + "], 'look_at':[r" + theUser.homelookat.X.ToString() + ",r" + theUser.homelookat.Y.ToString() + ",r" + theUser.homelookat.Z.ToString() + "]}";
response["sim_ip"] = SimInfo.sim_ip;
response["sim_port"] = (Int32)SimInfo.sim_port;
response["region_y"] = (Int32)SimInfo.RegionLocY * 256;
response["region_x"] = (Int32)SimInfo.RegionLocX * 256;
//default is ogs user server, so let the sim know about the user via a XmlRpcRequest
Console.WriteLine(SimInfo.caps_url);
Hashtable SimParams = new Hashtable();
SimParams["session_id"] = theUser.CurrentSessionID.ToString();
SimParams["secure_session_id"] = theUser.CurrentSecureSessionID.ToString();
SimParams["firstname"] = theUser.firstname;
SimParams["lastname"] = theUser.lastname;
SimParams["agent_id"] = theUser.UUID.ToString();
SimParams["circuit_code"] = (Int32)circode;
SimParams["startpos_x"] = theUser.homepos.X.ToString();
SimParams["startpos_y"] = theUser.homepos.Y.ToString();
SimParams["startpos_z"] = theUser.homepos.Z.ToString();
ArrayList SendParams = new ArrayList();
SendParams.Add(SimParams);
XmlRpcRequest GridReq = new XmlRpcRequest("expect_user", SendParams);
XmlRpcResponse GridResp = GridReq.Send(SimInfo.caps_url, 3000);
}
示例2: Connect
public bool Connect(string GridServerURL, string username, string password)
{
try
{
this.ServerURL=GridServerURL;
Hashtable LoginParamsHT = new Hashtable();
LoginParamsHT["username"]=username;
LoginParamsHT["password"]=password;
ArrayList LoginParams = new ArrayList();
LoginParams.Add(LoginParamsHT);
XmlRpcRequest GridLoginReq = new XmlRpcRequest("manager_login",LoginParams);
XmlRpcResponse GridResp = GridLoginReq.Send(ServerURL,3000);
if (GridResp.IsFault)
{
connected=false;
return false;
}
else
{
Hashtable gridrespData = (Hashtable)GridResp.Value;
this.SessionID = new LLUUID((string)gridrespData["session_id"]);
connected=true;
return true;
}
}
catch(Exception e)
{
Console.WriteLine(e.ToString());
connected=false;
return false;
}
}
示例3: RequestSimData
/// <summary>
/// Request sim data based on arbitrary key/value
/// </summary>
private RegionProfileData RequestSimData(Uri gridserverUrl, string gridserverSendkey, string keyField, string keyValue)
{
Hashtable requestData = new Hashtable();
requestData[keyField] = keyValue;
requestData["authkey"] = gridserverSendkey;
ArrayList SendParams = new ArrayList();
SendParams.Add(requestData);
XmlRpcRequest GridReq = new XmlRpcRequest("simulator_data_request", SendParams);
XmlRpcResponse GridResp = GridReq.Send(gridserverUrl.ToString(), 3000);
Hashtable responseData = (Hashtable) GridResp.Value;
RegionProfileData simData = null;
if (!responseData.ContainsKey("error"))
{
uint locX = Convert.ToUInt32((string)responseData["region_locx"]);
uint locY = Convert.ToUInt32((string)responseData["region_locy"]);
string externalHostName = (string)responseData["sim_ip"];
uint simPort = Convert.ToUInt32((string)responseData["sim_port"]);
uint httpPort = Convert.ToUInt32((string)responseData["http_port"]);
uint remotingPort = Convert.ToUInt32((string)responseData["remoting_port"]);
string serverUri = (string)responseData["server_uri"];
UUID regionID = new UUID((string)responseData["region_UUID"]);
string regionName = (string)responseData["region_name"];
byte access = Convert.ToByte((string)responseData["access"]);
simData = RegionProfileData.Create(regionID, regionName, locX, locY, externalHostName, simPort, httpPort, remotingPort, serverUri, access);
}
return simData;
}
示例4: LoadFromGrid
public SimProfile LoadFromGrid(LLUUID UUID, string GridURL, string SendKey, string RecvKey)
{
try
{
Hashtable GridReqParams = new Hashtable();
GridReqParams["UUID"] = UUID.ToString();
GridReqParams["authkey"] = SendKey;
ArrayList SendParams = new ArrayList();
SendParams.Add(GridReqParams);
XmlRpcRequest GridReq = new XmlRpcRequest("simulator_login", SendParams);
XmlRpcResponse GridResp = GridReq.Send(GridURL, 3000);
Hashtable RespData = (Hashtable)GridResp.Value;
this.UUID = new LLUUID((string)RespData["UUID"]);
this.regionhandle = Helpers.UIntsToLong(((uint)Convert.ToUInt32(RespData["region_locx"]) * 256), ((uint)Convert.ToUInt32(RespData["region_locy"]) * 256));
this.regionname = (string)RespData["regionname"];
this.sim_ip = (string)RespData["sim_ip"];
this.sim_port = (uint)Convert.ToUInt16(RespData["sim_port"]);
this.caps_url = "http://" + ((string)RespData["sim_ip"]) + ":" + (string)RespData["sim_port"] + "/";
this.RegionLocX = (uint)Convert.ToUInt32(RespData["region_locx"]);
this.RegionLocY = (uint)Convert.ToUInt32(RespData["region_locy"]);
this.sendkey = SendKey;
this.recvkey = RecvKey;
}
catch (Exception e)
{
Console.WriteLine(e.ToString());
}
return this;
}
示例5: GetLandData
public virtual LandData GetLandData(ulong regionHandle, uint x, uint y)
{
LandData landData = null;
Hashtable hash = new Hashtable();
hash["region_handle"] = regionHandle.ToString();
hash["x"] = x.ToString();
hash["y"] = y.ToString();
IList paramList = new ArrayList();
paramList.Add(hash);
try
{
RegionInfo info = m_MapService.RequestNeighbourInfo(regionHandle);
if (info != null) // just to be sure
{
XmlRpcRequest request = new XmlRpcRequest("land_data", paramList);
string uri = "http://" + info.ExternalEndPoint.Address + ":" + info.HttpPort + "/";
XmlRpcResponse response = request.Send(uri, 10000);
if (response.IsFault)
{
m_log.ErrorFormat("[LAND CONNECTOR] remote call returned an error: {0}", response.FaultString);
}
else
{
hash = (Hashtable)response.Value;
try
{
landData = new LandData();
landData.AABBMax = Vector3.Parse((string)hash["AABBMax"]);
landData.AABBMin = Vector3.Parse((string)hash["AABBMin"]);
landData.Area = Convert.ToInt32(hash["Area"]);
landData.AuctionID = Convert.ToUInt32(hash["AuctionID"]);
landData.Description = (string)hash["Description"];
landData.Flags = Convert.ToUInt32(hash["Flags"]);
landData.GlobalID = new UUID((string)hash["GlobalID"]);
landData.Name = (string)hash["Name"];
landData.OwnerID = new UUID((string)hash["OwnerID"]);
landData.SalePrice = Convert.ToInt32(hash["SalePrice"]);
landData.SnapshotID = new UUID((string)hash["SnapshotID"]);
landData.UserLocation = Vector3.Parse((string)hash["UserLocation"]);
m_log.DebugFormat("[OGS1 GRID SERVICES] Got land data for parcel {0}", landData.Name);
}
catch (Exception e)
{
m_log.Error("[LAND CONNECTOR] Got exception while parsing land-data:", e);
}
}
}
else m_log.WarnFormat("[LAND CONNECTOR] Couldn't find region with handle {0}", regionHandle);
}
catch (Exception e)
{
m_log.ErrorFormat("[LAND CONNECTOR] Couldn't contact region {0}: {1}", regionHandle, e);
}
return landData;
}
示例6: SendTransaction
public static Hashtable SendTransaction(string url, string trans, bool debug)
{
Hashtable hashtable = new Hashtable();
Hashtable hashtable2 = new Hashtable();
hashtable2["TransID"] = trans;
XmlRpcRequest xmlRpcRequest = new XmlRpcRequest("grid_store_transaction_message", new ArrayList
{
hashtable2
});
try
{
XmlRpcResponse xmlRpcResponse = xmlRpcRequest.Send(url, 10000);
Hashtable hashtable3 = (Hashtable)xmlRpcResponse.Value;
if (hashtable3.ContainsKey("success"))
{
if ((string)hashtable3["success"] == "true")
{
string value = (string)hashtable3["result"];
hashtable.Add("success", "true");
hashtable.Add("result", value);
if (debug)
{
StoreServiceConnector.m_log.DebugFormat("[Web Store Debug] Success", new object[0]);
}
}
else
{
string value2 = (string)hashtable3["result"];
hashtable.Add("success", "false");
hashtable.Add("result", value2);
if (debug)
{
StoreServiceConnector.m_log.DebugFormat("[Web Store Debug] Fail", new object[0]);
}
}
}
else
{
hashtable.Add("success", "false");
hashtable.Add("result", "The region server did not respond!");
StoreServiceConnector.m_log.DebugFormat("[Web Store Robust Module]: No response from Region Server! {0}", url);
}
}
catch (WebException ex)
{
hashtable.Add("success", "false");
StoreServiceConnector.m_log.ErrorFormat("[STORE]: Error sending transaction to {0} the host didn't respond " + ex.ToString(), url);
}
return hashtable;
}
示例7: RegionManagementBroadcastPostRequest
public string RegionManagementBroadcastPostRequest(AuroraWeb.Environment env, string message)
{
Request request = env.Request;
SessionInfo sinfo;
if (TryGetSessionInfo(request, out sinfo) &&
(sinfo.Account.UserLevel >= m_WebApp.AdminUserLevel))
{
env.Session = sinfo;
string url = m_WebApp.LoginURL;
Hashtable hash = new Hashtable();
if (m_ServerAdminPassword == null)
{
m_log.Debug("[RegionManagementBroadcastPostRequest] No remote admin password was set in .ini file");
}
hash["password"] = m_ServerAdminPassword;
hash["message"] = message;
IList paramList = new ArrayList();
paramList.Add(hash);
XmlRpcRequest xmlrpcReq = new XmlRpcRequest("admin_broadcast", paramList);
XmlRpcResponse response = null;
try
{
response = xmlrpcReq.Send(url, 10000);
env.Flags = Flags.IsAdmin | Flags.IsLoggedIn;
env.State = State.RegionManagementSuccessful;
}
catch (Exception e)
{
m_log.Debug("[AuroraWeb]: Exception " + e.Message);
env.Flags = Flags.IsAdmin | Flags.IsLoggedIn;
env.State = State.RegionManagementUnsuccessful;
}
return PadURLs(env, sinfo.Sid, m_WebApp.ReadFile(env, "index.html"));
}
return m_WebApp.ReadFile(env, "index.html");
}
示例8: SendInstantMessage
/// <summary>
/// This actually does the XMLRPC Request
/// </summary>
/// <param name="url">URL we pull the data out of to send the request to</param>
/// <param name="im">The Instant Message </param>
/// <returns>Bool if the message was successfully delivered at the other side.</returns>
public static bool SendInstantMessage(string url, GridInstantMessage im)
{
Hashtable xmlrpcdata = ConvertGridInstantMessageToXMLRPC(im);
xmlrpcdata["region_handle"] = 0;
ArrayList SendParams = new ArrayList();
SendParams.Add(xmlrpcdata);
XmlRpcRequest GridReq = new XmlRpcRequest("grid_instant_message", SendParams);
try
{
XmlRpcResponse GridResp = GridReq.Send(url, 10000);
Hashtable responseData = (Hashtable)GridResp.Value;
if (responseData.ContainsKey("success"))
{
if ((string)responseData["success"] == "TRUE")
{
//m_log.DebugFormat("[XXX] Success");
return true;
}
else
{
//m_log.DebugFormat("[XXX] Fail");
return false;
}
}
else
{
m_log.DebugFormat("[GRID INSTANT MESSAGE]: No response from {0}", url);
return false;
}
}
catch (WebException e)
{
m_log.ErrorFormat("[GRID INSTANT MESSAGE]: Error sending message to {0} the host didn't respond " + e.ToString(), url);
}
return false;
}
示例9: GetNewKey
public static string GetNewKey(string authurl, UUID userID, UUID authToken)
{
//Hashtable keyParams = new Hashtable();
//keyParams["user_id"] = userID;
//keyParams["auth_token"] = authKey;
List<string> SendParams = new List<string>();
SendParams.Add(userID.ToString());
SendParams.Add(authToken.ToString());
string methodName = "hg_new_auth_key";
XmlRpcRequest request = new XmlRpcRequest(methodName, SendParams);
XmlRpcResponse reply;
try
{
reply = request.Send(Util.XmlRpcRequestURI(authurl, methodName), 6000);
}
catch (Exception e)
{
System.Console.WriteLine("[HGrid]: Failed to get new key. Reason: " + e.Message);
return String.Empty;
}
if (!reply.IsFault)
{
string newKey = String.Empty;
if (reply.Value != null)
newKey = (string)reply.Value;
return newKey;
}
else
{
System.Console.WriteLine("[HGrid]: XmlRpc request to get auth key failed with message {0}" + reply.FaultString + ", code " + reply.FaultCode);
return String.Empty;
}
}
示例10: RequestSimData
/// <summary>
/// Request sim data based on arbitrary key/value
/// </summary>
private RegionProfileData RequestSimData(Uri gridserverUrl, string gridserverSendkey, string keyField, string keyValue)
{
Hashtable requestData = new Hashtable();
requestData[keyField] = keyValue;
requestData["authkey"] = gridserverSendkey;
ArrayList SendParams = new ArrayList();
SendParams.Add(requestData);
string methodName = "simulator_data_request";
XmlRpcRequest GridReq = new XmlRpcRequest(methodName, SendParams);
XmlRpcResponse GridResp = GridReq.Send(Util.XmlRpcRequestURI(gridserverUrl.ToString(), methodName), 5000);
Hashtable responseData = (Hashtable) GridResp.Value;
RegionProfileData simData = null;
if (!responseData.ContainsKey("error"))
{
uint locX = Convert.ToUInt32((string)responseData["region_locx"]);
uint locY = Convert.ToUInt32((string)responseData["region_locy"]);
string externalHostName = (string)responseData["sim_ip"];
uint simPort = Convert.ToUInt32((string)responseData["sim_port"]);
uint httpPort = Convert.ToUInt32((string)responseData["http_port"]);
uint remotingPort = Convert.ToUInt32((string)responseData["remoting_port"]);
UUID regionID = new UUID((string)responseData["region_UUID"]);
string regionName = (string)responseData["region_name"];
byte access = Convert.ToByte((string)responseData["access"]);
ProductRulesUse product = (ProductRulesUse)Convert.ToInt32(responseData["product"]);
string outsideIp = null;
if (responseData.ContainsKey("outside_ip"))
outsideIp = (string)responseData["outside_ip"];
simData = RegionProfileData.Create(regionID, regionName, locX, locY, externalHostName, simPort, httpPort, remotingPort, access, product, outsideIp);
}
return simData;
}
示例11: GetHyperlinkRegion
public GridRegion GetHyperlinkRegion(GridRegion gatekeeper, UUID regionID)
{
Hashtable hash = new Hashtable ();
hash["region_uuid"] = regionID.ToString ();
IList paramList = new ArrayList ();
paramList.Add (hash);
XmlRpcRequest request = new XmlRpcRequest ("get_region", paramList);
MainConsole.Instance.Debug ("[GATEKEEPER SERVICE CONNECTOR]: contacting " + gatekeeper.ServerURI);
XmlRpcResponse response = null;
try
{
response = request.Send (gatekeeper.ServerURI, 10000);
}
catch (Exception e)
{
MainConsole.Instance.Debug ("[GATEKEEPER SERVICE CONNECTOR]: Exception " + e.Message);
return null;
}
if (response.IsFault)
{
MainConsole.Instance.ErrorFormat ("[GATEKEEPER SERVICE CONNECTOR]: remote call returned an error: {0}", response.FaultString);
return null;
}
hash = (Hashtable)response.Value;
//foreach (Object o in hash)
// MainConsole.Instance.Debug(">> " + ((DictionaryEntry)o).Key + ":" + ((DictionaryEntry)o).Value);
try
{
bool success = false;
Boolean.TryParse ((string)hash["result"], out success);
if (success)
{
GridRegion region = new GridRegion ();
UUID.TryParse ((string)hash["uuid"], out region.RegionID);
//MainConsole.Instance.Debug(">> HERE, uuid: " + region.RegionID);
int n = 0;
if (hash["x"] != null)
{
Int32.TryParse ((string)hash["x"], out n);
region.RegionLocX = n;
//MainConsole.Instance.Debug(">> HERE, x: " + region.RegionLocX);
}
if (hash["y"] != null)
{
Int32.TryParse ((string)hash["y"], out n);
region.RegionLocY = n;
//MainConsole.Instance.Debug(">> HERE, y: " + region.RegionLocY);
}
if (hash["region_name"] != null)
{
region.RegionName = (string)hash["region_name"];
//MainConsole.Instance.Debug(">> HERE, region_name: " + region.RegionName);
}
if (hash["hostname"] != null)
{
region.ExternalHostName = (string)hash["hostname"];
//MainConsole.Instance.Debug(">> HERE, hostname: " + region.ExternalHostName);
}
if (hash["http_port"] != null)
{
uint p = 0;
UInt32.TryParse ((string)hash["http_port"], out p);
region.HttpPort = p;
//MainConsole.Instance.Debug(">> HERE, http_port: " + region.HttpPort);
}
if (hash["internal_port"] != null)
{
int p = 0;
Int32.TryParse ((string)hash["internal_port"], out p);
region.InternalEndPoint = new IPEndPoint (IPAddress.Parse ("0.0.0.0"), p);
//MainConsole.Instance.Debug(">> HERE, internal_port: " + region.InternalEndPoint);
}
if (hash["server_uri"] != null)
{
region.ServerURI = (string)hash["server_uri"];
//MainConsole.Instance.Debug(">> HERE, server_uri: " + region.ServerURI);
}
// Successful return
return region;
}
}
catch (Exception e)
{
MainConsole.Instance.Error ("[GATEKEEPER SERVICE CONNECTOR]: Got exception while parsing hyperlink response " + e.StackTrace);
return null;
}
return null;
}
示例12: CheckAuthSession
/// <summary>
/// Check that the source of an inventory request for a particular agent is a current session belonging to
/// that agent.
/// </summary>
/// <param name="session_id"></param>
/// <param name="avatar_id"></param>
/// <returns></returns>
public bool CheckAuthSession(string session_id, string avatar_id)
{
if (m_doLookup)
{
m_log.InfoFormat("[GRID AGENT INVENTORY]: checking authed session {0} {1}", session_id, avatar_id);
if (m_session_cache.getCachedSession(session_id, avatar_id) == null)
{
// cache miss, ask userserver
Hashtable requestData = new Hashtable();
requestData["avatar_uuid"] = avatar_id;
requestData["session_id"] = session_id;
ArrayList SendParams = new ArrayList();
SendParams.Add(requestData);
XmlRpcRequest UserReq = new XmlRpcRequest("check_auth_session", SendParams);
XmlRpcResponse UserResp = UserReq.Send(m_userserver_url, 3000);
Hashtable responseData = (Hashtable)UserResp.Value;
if (responseData.ContainsKey("auth_session") && responseData["auth_session"].ToString() == "TRUE")
{
m_log.Info("[GRID AGENT INVENTORY]: got authed session from userserver");
// add to cache; the session time will be automatically renewed
m_session_cache.Add(session_id, avatar_id);
return true;
}
}
else
{
// cache hits
m_log.Info("[GRID AGENT INVENTORY]: got authed session from cache");
return true;
}
m_log.Warn("[GRID AGENT INVENTORY]: unknown session_id, request rejected");
return false;
}
else
{
return true;
}
}
示例13: BeginLogin
//.........这里部分代码省略.........
{
if (!optionsOSD.Contains(callbackOpts[i]))
optionsOSD.Add(callbackOpts[i]);
}
}
}
loginLLSD["options"] = optionsOSD;
// Make the CAPS POST for login
Uri loginUri;
try
{
loginUri = new Uri(loginParams.URI);
}
catch (Exception ex)
{
Logger.Log(String.Format("Failed to parse login URI {0}, {1}", loginParams.URI, ex.Message),
Helpers.LogLevel.Error, Client);
return;
}
CapsClient loginRequest = new CapsClient(loginUri);
loginRequest.OnComplete += new CapsClient.CompleteCallback(LoginReplyLLSDHandler);
loginRequest.UserData = CurrentContext;
UpdateLoginStatus(LoginStatus.ConnectingToLogin, String.Format("Logging in as {0} {1}...", loginParams.FirstName, loginParams.LastName));
loginRequest.BeginGetResponse(loginLLSD, OSDFormat.Xml, Client.Settings.CAPS_TIMEOUT);
#endregion
}
else
{
#region XML-RPC Based Login Code
// Create the Hashtable for XmlRpcCs
Hashtable loginXmlRpc = new Hashtable();
loginXmlRpc["first"] = loginParams.FirstName;
loginXmlRpc["last"] = loginParams.LastName;
loginXmlRpc["passwd"] = loginParams.Password;
loginXmlRpc["start"] = loginParams.Start;
loginXmlRpc["channel"] = loginParams.Channel;
loginXmlRpc["version"] = loginParams.Version;
loginXmlRpc["platform"] = loginParams.Platform;
loginXmlRpc["mac"] = loginParams.MAC;
if (loginParams.AgreeToTos)
loginXmlRpc["agree_to_tos"] = "true";
if (loginParams.ReadCritical)
loginXmlRpc["read_critical"] = "true";
loginXmlRpc["id0"] = loginParams.ID0;
loginXmlRpc["last_exec_event"] = 0;
// Create the options array
ArrayList options = new ArrayList();
for (int i = 0; i < loginParams.Options.Length; i++)
options.Add(loginParams.Options[i]);
foreach (string[] callbackOpts in CallbackOptions.Values)
{
if (callbackOpts != null)
{
for (int i = 0; i < callbackOpts.Length; i++)
{
if (!options.Contains(callbackOpts[i]))
options.Add(callbackOpts[i]);
}
}
}
loginXmlRpc["options"] = options;
try
{
ArrayList loginArray = new ArrayList(1);
loginArray.Add(loginXmlRpc);
XmlRpcRequest request = new XmlRpcRequest(CurrentContext.Value.MethodName, loginArray);
// Start the request
Thread requestThread = new Thread(
delegate()
{
try
{
LoginReplyXmlRpcHandler(
request.Send(CurrentContext.Value.URI, CurrentContext.Value.Timeout),
loginParams);
}
catch (WebException e)
{
UpdateLoginStatus(LoginStatus.Failed, "Error opening the login server connection: " + e.Message);
}
});
requestThread.Name = "XML-RPC Login";
requestThread.Start();
}
catch (Exception e)
{
UpdateLoginStatus(LoginStatus.Failed, "Error opening the login server connection: " + e);
}
#endregion
}
}
示例14: LogOffUser
public override void LogOffUser(UserProfileData theUser, string message)
{
RegionProfileData SimInfo;
try
{
SimInfo = m_regionProfileService.RequestSimProfileData(
theUser.CurrentAgent.Handle, m_config.GridServerURL,
m_config.GridSendKey, m_config.GridRecvKey);
if (SimInfo == null)
{
m_log.Error("[GRID]: Region user was in isn't currently logged in");
return;
}
}
catch (Exception)
{
m_log.Error("[GRID]: Unable to look up region to log user off");
return;
}
// Prepare notification
Hashtable SimParams = new Hashtable();
SimParams["agent_id"] = theUser.ID.ToString();
SimParams["region_secret"] = theUser.CurrentAgent.SecureSessionID.ToString();
SimParams["region_secret2"] = SimInfo.regionSecret;
//m_log.Info(SimInfo.regionSecret);
SimParams["regionhandle"] = theUser.CurrentAgent.Handle.ToString();
SimParams["message"] = message;
ArrayList SendParams = new ArrayList();
SendParams.Add(SimParams);
m_log.InfoFormat(
"[ASSUMED CRASH]: Telling region {0} @ {1},{2} ({3}) that their agent is dead: {4}",
SimInfo.regionName, SimInfo.regionLocX, SimInfo.regionLocY, SimInfo.httpServerURI,
theUser.FirstName + " " + theUser.SurName);
try
{
string methodName = "logoff_user";
XmlRpcRequest GridReq = new XmlRpcRequest(methodName, SendParams);
XmlRpcResponse GridResp = GridReq.Send(Util.XmlRpcRequestURI(SimInfo.httpServerURI, methodName), 6000);
if (GridResp.IsFault)
{
m_log.ErrorFormat(
"[LOGIN]: XMLRPC request for {0} failed, fault code: {1}, reason: {2}, This is likely an old region revision.",
SimInfo.httpServerURI, GridResp.FaultCode, GridResp.FaultString);
}
}
catch (Exception)
{
m_log.Error("[LOGIN]: Error telling region to logout user!");
}
// Prepare notification
SimParams = new Hashtable();
SimParams["agent_id"] = theUser.ID.ToString();
SimParams["region_secret"] = SimInfo.regionSecret;
//m_log.Info(SimInfo.regionSecret);
SimParams["regionhandle"] = theUser.CurrentAgent.Handle.ToString();
SimParams["message"] = message;
SendParams = new ArrayList();
SendParams.Add(SimParams);
m_log.InfoFormat(
"[ASSUMED CRASH]: Telling region {0} @ {1},{2} ({3}) that their agent is dead: {4}",
SimInfo.regionName, SimInfo.regionLocX, SimInfo.regionLocY, SimInfo.httpServerURI,
theUser.FirstName + " " + theUser.SurName);
try
{
string methodName = "logoff_user";
XmlRpcRequest GridReq = new XmlRpcRequest(methodName, SendParams);
XmlRpcResponse GridResp = GridReq.Send(Util.XmlRpcRequestURI(SimInfo.httpServerURI, methodName), 6000);
if (GridResp.IsFault)
{
m_log.ErrorFormat(
"[LOGIN]: XMLRPC request for {0} failed, fault code: {1}, reason: {2}, This is likely an old region revision.",
SimInfo.httpServerURI, GridResp.FaultCode, GridResp.FaultString);
}
}
catch (Exception)
{
m_log.Error("[LOGIN]: Error telling region to logout user!");
}
//base.LogOffUser(theUser);
}
示例15: GetUUI
public string GetUUI(UUID userID, UUID targetUserID)
{
Hashtable hash = new Hashtable();
hash["userID"] = userID.ToString();
hash["targetUserID"] = targetUserID.ToString();
IList paramList = new ArrayList();
paramList.Add(hash);
XmlRpcRequest request = new XmlRpcRequest("get_uui", paramList);
// string reason = string.Empty;
// Send and get reply
string uui = string.Empty;
XmlRpcResponse response = null;
try
{
response = request.Send(m_ServerURL, 10000);
}
catch
{
m_log.DebugFormat("[USER AGENT CONNECTOR]: Unable to contact remote server {0} for GetUUI", m_ServerURL);
// reason = "Exception: " + e.Message;
return uui;
}
if (response.IsFault)
{
m_log.ErrorFormat("[USER AGENT CONNECTOR]: remote call to {0} for GetUUI returned an error: {1}", m_ServerURL, response.FaultString);
// reason = "XMLRPC Fault";
return uui;
}
hash = (Hashtable)response.Value;
//foreach (Object o in hash)
// m_log.Debug(">> " + ((DictionaryEntry)o).Key + ":" + ((DictionaryEntry)o).Value);
try
{
if (hash == null)
{
m_log.ErrorFormat("[USER AGENT CONNECTOR]: GetUUI Got null response from {0}! THIS IS BAAAAD", m_ServerURL);
// reason = "Internal error 1";
return uui;
}
// Here's the actual response
if (hash.ContainsKey("UUI"))
uui = hash["UUI"].ToString();
}
catch
{
m_log.ErrorFormat("[USER AGENT CONNECTOR]: Got exception on LocateUser response.");
// reason = "Exception: " + e.Message;
}
return uui;
}