Merge branch 'master' into careminster
Conflicts: OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.csavinationmerge
commit
ae833af3a9
|
@ -365,60 +365,8 @@ namespace OpenSim.Region.CoreModules.Asset
|
||||||
/// <param name="id"></param>
|
/// <param name="id"></param>
|
||||||
/// <returns>An asset retrieved from the file cache. null if there was a problem retrieving an asset.</returns>
|
/// <returns>An asset retrieved from the file cache. null if there was a problem retrieving an asset.</returns>
|
||||||
private AssetBase GetFromFileCache(string id)
|
private AssetBase GetFromFileCache(string id)
|
||||||
{
|
{
|
||||||
AssetBase asset = null;
|
|
||||||
|
|
||||||
string filename = GetFileName(id);
|
string filename = GetFileName(id);
|
||||||
while (File.Exists(filename))
|
|
||||||
{
|
|
||||||
FileStream stream = null;
|
|
||||||
try
|
|
||||||
{
|
|
||||||
stream = File.Open(filename, FileMode.Open, FileAccess.Read, FileShare.Read);
|
|
||||||
BinaryFormatter bformatter = new BinaryFormatter();
|
|
||||||
|
|
||||||
asset = (AssetBase)bformatter.Deserialize(stream);
|
|
||||||
|
|
||||||
m_DiskHits++;
|
|
||||||
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
catch (System.Runtime.Serialization.SerializationException e)
|
|
||||||
{
|
|
||||||
m_log.WarnFormat(
|
|
||||||
"[FLOTSAM ASSET CACHE]: Failed to get file {0} for asset {1}. Exception {2} {3}",
|
|
||||||
filename, id, e.Message, e.StackTrace);
|
|
||||||
|
|
||||||
// If there was a problem deserializing the asset, the asset may
|
|
||||||
// either be corrupted OR was serialized under an old format
|
|
||||||
// {different version of AssetBase} -- we should attempt to
|
|
||||||
// delete it and re-cache
|
|
||||||
File.Delete(filename);
|
|
||||||
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
catch (IOException e)
|
|
||||||
{
|
|
||||||
// This is a sharing violation: File exists but can't be opened because it's
|
|
||||||
// being written
|
|
||||||
Thread.Sleep(100);
|
|
||||||
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
m_log.WarnFormat(
|
|
||||||
"[FLOTSAM ASSET CACHE]: Failed to get file {0} for asset {1}. Exception {2} {3}",
|
|
||||||
filename, id, e.Message, e.StackTrace);
|
|
||||||
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
finally
|
|
||||||
{
|
|
||||||
if (stream != null)
|
|
||||||
stream.Close();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#if WAIT_ON_INPROGRESS_REQUESTS
|
#if WAIT_ON_INPROGRESS_REQUESTS
|
||||||
// Check if we're already downloading this asset. If so, try to wait for it to
|
// Check if we're already downloading this asset. If so, try to wait for it to
|
||||||
|
@ -440,8 +388,50 @@ namespace OpenSim.Region.CoreModules.Asset
|
||||||
if (m_CurrentlyWriting.Contains(filename))
|
if (m_CurrentlyWriting.Contains(filename))
|
||||||
{
|
{
|
||||||
m_RequestsForInprogress++;
|
m_RequestsForInprogress++;
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
AssetBase asset = null;
|
||||||
|
|
||||||
|
if (File.Exists(filename))
|
||||||
|
{
|
||||||
|
FileStream stream = null;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
stream = File.Open(filename, FileMode.Open, FileAccess.Read, FileShare.Read);
|
||||||
|
BinaryFormatter bformatter = new BinaryFormatter();
|
||||||
|
|
||||||
|
asset = (AssetBase)bformatter.Deserialize(stream);
|
||||||
|
|
||||||
|
m_DiskHits++;
|
||||||
|
}
|
||||||
|
catch (System.Runtime.Serialization.SerializationException e)
|
||||||
|
{
|
||||||
|
m_log.WarnFormat(
|
||||||
|
"[FLOTSAM ASSET CACHE]: Failed to get file {0} for asset {1}. Exception {2} {3}",
|
||||||
|
filename, id, e.Message, e.StackTrace);
|
||||||
|
|
||||||
|
// If there was a problem deserializing the asset, the asset may
|
||||||
|
// either be corrupted OR was serialized under an old format
|
||||||
|
// {different version of AssetBase} -- we should attempt to
|
||||||
|
// delete it and re-cache
|
||||||
|
File.Delete(filename);
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
m_log.WarnFormat(
|
||||||
|
"[FLOTSAM ASSET CACHE]: Failed to get file {0} for asset {1}. Exception {2} {3}",
|
||||||
|
filename, id, e.Message, e.StackTrace);
|
||||||
|
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
if (stream != null)
|
||||||
|
stream.Close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return asset;
|
return asset;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1289,16 +1289,16 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public delegate void InformClientToInitateTeleportToLocationDelegate(ScenePresence agent, uint regionX, uint regionY,
|
public delegate void InformClientToInitiateTeleportToLocationDelegate(ScenePresence agent, uint regionX, uint regionY,
|
||||||
Vector3 position,
|
Vector3 position,
|
||||||
Scene initiatingScene);
|
Scene initiatingScene);
|
||||||
|
|
||||||
private void InformClientToInitateTeleportToLocation(ScenePresence agent, uint regionX, uint regionY, Vector3 position, Scene initiatingScene)
|
private void InformClientToInitiateTeleportToLocation(ScenePresence agent, uint regionX, uint regionY, Vector3 position, Scene initiatingScene)
|
||||||
{
|
{
|
||||||
|
|
||||||
// This assumes that we know what our neighbours are.
|
// This assumes that we know what our neighbours are.
|
||||||
|
|
||||||
InformClientToInitateTeleportToLocationDelegate d = InformClientToInitiateTeleportToLocationAsync;
|
InformClientToInitiateTeleportToLocationDelegate d = InformClientToInitiateTeleportToLocationAsync;
|
||||||
d.BeginInvoke(agent, regionX, regionY, position, initiatingScene,
|
d.BeginInvoke(agent, regionX, regionY, position, initiatingScene,
|
||||||
InformClientToInitiateTeleportToLocationCompleted,
|
InformClientToInitiateTeleportToLocationCompleted,
|
||||||
d);
|
d);
|
||||||
|
@ -1360,8 +1360,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||||
|
|
||||||
private void InformClientToInitiateTeleportToLocationCompleted(IAsyncResult iar)
|
private void InformClientToInitiateTeleportToLocationCompleted(IAsyncResult iar)
|
||||||
{
|
{
|
||||||
InformClientToInitateTeleportToLocationDelegate icon =
|
InformClientToInitiateTeleportToLocationDelegate icon =
|
||||||
(InformClientToInitateTeleportToLocationDelegate)iar.AsyncState;
|
(InformClientToInitiateTeleportToLocationDelegate)iar.AsyncState;
|
||||||
icon.EndInvoke(iar);
|
icon.EndInvoke(iar);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue