Fix bug where simultaneous calls by different scripts to llGetNotecardLine() or llGetNumberOfNotecardLines() would sometimes not trigger a dataserver event.

This was because the notecard asset ID was being used as the request identifier.
Now using a random ID, in common with other code using the DataServer
0.7.4-extended
Justin Clark-Casey (justincc) 2013-02-28 21:15:14 +00:00
parent f95c5dd58e
commit ff199668fe
1 changed files with 14 additions and 12 deletions

View File

@ -10627,14 +10627,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
return UUID.Zero.ToString(); return UUID.Zero.ToString();
} }
string reqIdentifier = UUID.Random().ToString();
// was: UUID tid = tid = AsyncCommands. // was: UUID tid = tid = AsyncCommands.
UUID tid = AsyncCommands.DataserverPlugin.RegisterRequest(m_host.LocalId, m_item.ItemID, assetID.ToString()); UUID tid = AsyncCommands.DataserverPlugin.RegisterRequest(m_host.LocalId, m_item.ItemID, reqIdentifier);
if (NotecardCache.IsCached(assetID)) if (NotecardCache.IsCached(assetID))
{ {
AsyncCommands. AsyncCommands.DataserverPlugin.DataserverReply(reqIdentifier, NotecardCache.GetLines(assetID).ToString());
DataserverPlugin.DataserverReply(assetID.ToString(),
NotecardCache.GetLines(assetID).ToString());
ScriptSleep(100); ScriptSleep(100);
return tid.ToString(); return tid.ToString();
} }
@ -10650,9 +10651,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
string data = Encoding.UTF8.GetString(a.Data); string data = Encoding.UTF8.GetString(a.Data);
//m_log.Debug(data); //m_log.Debug(data);
NotecardCache.Cache(id, data); NotecardCache.Cache(id, data);
AsyncCommands. AsyncCommands.DataserverPlugin.DataserverReply(reqIdentifier, NotecardCache.GetLines(id).ToString());
DataserverPlugin.DataserverReply(id.ToString(),
NotecardCache.GetLines(id).ToString());
}); });
ScriptSleep(100); ScriptSleep(100);
@ -10681,13 +10680,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
return UUID.Zero.ToString(); return UUID.Zero.ToString();
} }
string reqIdentifier = UUID.Random().ToString();
// was: UUID tid = tid = AsyncCommands. // was: UUID tid = tid = AsyncCommands.
UUID tid = AsyncCommands.DataserverPlugin.RegisterRequest(m_host.LocalId, m_item.ItemID, assetID.ToString()); UUID tid = AsyncCommands.DataserverPlugin.RegisterRequest(m_host.LocalId, m_item.ItemID, reqIdentifier);
if (NotecardCache.IsCached(assetID)) if (NotecardCache.IsCached(assetID))
{ {
AsyncCommands.DataserverPlugin.DataserverReply(assetID.ToString(), AsyncCommands.DataserverPlugin.DataserverReply(
NotecardCache.GetLine(assetID, line, m_notecardLineReadCharsMax)); reqIdentifier, NotecardCache.GetLine(assetID, line, m_notecardLineReadCharsMax));
ScriptSleep(100); ScriptSleep(100);
return tid.ToString(); return tid.ToString();
} }
@ -10703,8 +10705,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
string data = Encoding.UTF8.GetString(a.Data); string data = Encoding.UTF8.GetString(a.Data);
//m_log.Debug(data); //m_log.Debug(data);
NotecardCache.Cache(id, data); NotecardCache.Cache(id, data);
AsyncCommands.DataserverPlugin.DataserverReply(id.ToString(), AsyncCommands.DataserverPlugin.DataserverReply(
NotecardCache.GetLine(id, line, m_notecardLineReadCharsMax)); reqIdentifier, NotecardCache.GetLine(assetID, line, m_notecardLineReadCharsMax));
}); });
ScriptSleep(100); ScriptSleep(100);