Merge branch 'master' into careminster

Conflicts:
	OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs
	OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
avinationmerge
Melanie 2013-03-31 20:56:13 +01:00
commit ae833af3a9
2 changed files with 48 additions and 58 deletions

View File

@ -365,60 +365,8 @@ namespace OpenSim.Region.CoreModules.Asset
/// <param name="id"></param>
/// <returns>An asset retrieved from the file cache. null if there was a problem retrieving an asset.</returns>
private AssetBase GetFromFileCache(string id)
{
AssetBase asset = null;
{
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
// 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))
{
m_RequestsForInprogress++;
return null;
}
#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;
}

View File

@ -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,
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.
InformClientToInitateTeleportToLocationDelegate d = InformClientToInitiateTeleportToLocationAsync;
InformClientToInitiateTeleportToLocationDelegate d = InformClientToInitiateTeleportToLocationAsync;
d.BeginInvoke(agent, regionX, regionY, position, initiatingScene,
InformClientToInitiateTeleportToLocationCompleted,
d);
@ -1360,8 +1360,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
private void InformClientToInitiateTeleportToLocationCompleted(IAsyncResult iar)
{
InformClientToInitateTeleportToLocationDelegate icon =
(InformClientToInitateTeleportToLocationDelegate)iar.AsyncState;
InformClientToInitiateTeleportToLocationDelegate icon =
(InformClientToInitiateTeleportToLocationDelegate)iar.AsyncState;
icon.EndInvoke(iar);
}