This fixes the crash reported in http://opensimulator.org/mantis/view.php?id=5529 related to sending IMs to foreign friends who are offline. Hopefully.

bulletsim
Diva Canto 2011-06-07 10:51:12 -07:00
parent 1a23d322ac
commit f5d82350bb
6 changed files with 32 additions and 33 deletions

View File

@ -196,10 +196,9 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
Util.FireAndForget(delegate Util.FireAndForget(delegate
{ {
bool success = m_IMService.OutgoingInstantMessage(im, url, foreigner); bool success = false;
if (!success && account == null) if (foreigner && url == string.Empty) // we don't know about this user
{ {
// One last chance
string recipientUUI = TryGetRecipientUUI(new UUID(im.fromAgentID), toAgentID); string recipientUUI = TryGetRecipientUUI(new UUID(im.fromAgentID), toAgentID);
m_log.DebugFormat("[HG MESSAGE TRANSFER]: Got UUI {0}", recipientUUI); m_log.DebugFormat("[HG MESSAGE TRANSFER]: Got UUI {0}", recipientUUI);
if (recipientUUI != string.Empty) if (recipientUUI != string.Empty)
@ -213,6 +212,9 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
} }
} }
} }
else
success = m_IMService.OutgoingInstantMessage(im, url, foreigner);
if (!success && !foreigner) if (!success && !foreigner)
HandleUndeliveredMessage(im, result); HandleUndeliveredMessage(im, result);
else else

View File

@ -268,18 +268,18 @@ namespace OpenSim.Server.Handlers.Hypergrid
ids.Add(requestData[key].ToString()); ids.Add(requestData[key].ToString());
} }
List<UUID> online = m_HomeUsersService.GetOnlineFriends(userID, ids); //List<UUID> online = m_HomeUsersService.GetOnlineFriends(userID, ids);
if (online.Count > 0) //if (online.Count > 0)
{ //{
int i = 0; // int i = 0;
foreach (UUID id in online) // foreach (UUID id in online)
{ // {
hash["friend_" + i.ToString()] = id.ToString(); // hash["friend_" + i.ToString()] = id.ToString();
i++; // i++;
} // }
} //}
else //else
hash["result"] = "No Friends Online"; // hash["result"] = "No Friends Online";
} }
XmlRpcResponse response = new XmlRpcResponse(); XmlRpcResponse response = new XmlRpcResponse();

View File

@ -185,7 +185,6 @@ namespace OpenSim.Services.HypergridService
{ {
lookupAgent = true; lookupAgent = true;
upd = null; upd = null;
url = string.Empty;
} }
} }
else else
@ -221,8 +220,6 @@ namespace OpenSim.Services.HypergridService
url = m_UserAgentService.LocateUser(toAgentID); url = m_UserAgentService.LocateUser(toAgentID);
} }
if (upd != null || url != string.Empty)
{
// check if we've tried this before.. // check if we've tried this before..
// This is one way to end the recursive loop // This is one way to end the recursive loop
// //
@ -235,7 +232,6 @@ namespace OpenSim.Services.HypergridService
return false; return false;
} }
} }
}
if (upd != null) if (upd != null)
{ {
@ -332,10 +328,6 @@ namespace OpenSim.Services.HypergridService
else else
{ {
// try again, but lookup user this time. // try again, but lookup user this time.
// Warning, this must call the Async version
// of this method or we'll be making thousands of threads
// The version within the spawned thread is SendGridInstantMessageViaXMLRPCAsync
// The version that spawns the thread is SendGridInstantMessageViaXMLRPC
// This is recursive!!!!! // This is recursive!!!!!
return TrySendInstantMessage(im, url, false, foreigner); return TrySendInstantMessage(im, url, false, foreigner);
@ -348,13 +340,17 @@ namespace OpenSim.Services.HypergridService
if (m_RestURL != string.Empty && (im.offline != 0) if (m_RestURL != string.Empty && (im.offline != 0)
&& (!im.fromGroup || (im.fromGroup && m_ForwardOfflineGroupMessages))) && (!im.fromGroup || (im.fromGroup && m_ForwardOfflineGroupMessages)))
{ {
m_log.DebugFormat("[HG IM SERVICE]: Message saved");
return SynchronousRestObjectPoster.BeginPostObject<GridInstantMessage, bool>( return SynchronousRestObjectPoster.BeginPostObject<GridInstantMessage, bool>(
"POST", m_RestURL + "/SaveMessage/", im); "POST", m_RestURL + "/SaveMessage/", im);
} }
else else
{
m_log.DebugFormat("[HG IM SERVICE]: No offline IM service, message not saved");
return false; return false;
} }
} }
}
} }

View File

@ -482,7 +482,7 @@ namespace OpenSim.Services.HypergridService
{ {
foreach (TravelingAgentInfo t in m_TravelingAgents.Values) foreach (TravelingAgentInfo t in m_TravelingAgents.Values)
{ {
if (t.UserID == userID) if (t.UserID == userID && !m_GridName.Equals(t.GridExternalName))
return t.GridExternalName; return t.GridExternalName;
} }

View File

@ -62,7 +62,7 @@ namespace OpenSim.Services.Interfaces
string GetUUI(UUID userID, UUID targetUserID); string GetUUI(UUID userID, UUID targetUserID);
void StatusNotification(List<string> friends, UUID userID, bool online); void StatusNotification(List<string> friends, UUID userID, bool online);
List<UUID> GetOnlineFriends(UUID userID, List<string> friends); //List<UUID> GetOnlineFriends(UUID userID, List<string> friends);
bool AgentIsComingHome(UUID sessionID, string thisGridExternalName); bool AgentIsComingHome(UUID sessionID, string thisGridExternalName);
bool VerifyAgent(UUID sessionID, string token); bool VerifyAgent(UUID sessionID, string token);

View File

@ -160,6 +160,7 @@
GridService = "OpenSim.Services.GridService.dll:GridService" GridService = "OpenSim.Services.GridService.dll:GridService"
PresenceService = "OpenSim.Services.PresenceService.dll:PresenceService" PresenceService = "OpenSim.Services.PresenceService.dll:PresenceService"
UserAgentService = "OpenSim.Services.HypergridService.dll:UserAgentService" UserAgentService = "OpenSim.Services.HypergridService.dll:UserAgentService"
InGatekeeper = True
;; This should always be the very last thing on this file ;; This should always be the very last thing on this file