Merge branch 'master' into varregion

This commit is contained in:
Robert Adams
2013-10-16 07:53:44 -07:00
71 changed files with 17519 additions and 232 deletions

View File

@@ -829,26 +829,23 @@ namespace OpenSim.Region.CoreModules.World.Estate
private void AbortTerrainXferHandler(IClientAPI remoteClient, ulong XferID)
{
if (TerrainUploader != null)
lock (this)
{
lock (TerrainUploader)
if ((TerrainUploader != null) && (XferID == TerrainUploader.XferID))
{
if (XferID == TerrainUploader.XferID)
{
remoteClient.OnXferReceive -= TerrainUploader.XferReceive;
remoteClient.OnAbortXfer -= AbortTerrainXferHandler;
TerrainUploader.TerrainUploadDone -= HandleTerrainApplication;
remoteClient.OnXferReceive -= TerrainUploader.XferReceive;
remoteClient.OnAbortXfer -= AbortTerrainXferHandler;
TerrainUploader.TerrainUploadDone -= HandleTerrainApplication;
TerrainUploader = null;
remoteClient.SendAlertMessage("Terrain Upload aborted by the client");
}
TerrainUploader = null;
remoteClient.SendAlertMessage("Terrain Upload aborted by the client");
}
}
}
private void HandleTerrainApplication(string filename, byte[] terrainData, IClientAPI remoteClient)
{
lock (TerrainUploader)
lock (this)
{
remoteClient.OnXferReceive -= TerrainUploader.XferReceive;
remoteClient.OnAbortXfer -= AbortTerrainXferHandler;
@@ -907,22 +904,32 @@ namespace OpenSim.Region.CoreModules.World.Estate
private void handleUploadTerrain(IClientAPI remote_client, string clientFileName)
{
if (TerrainUploader == null)
lock (this)
{
TerrainUploader = new EstateTerrainXferHandler(remote_client, clientFileName);
lock (TerrainUploader)
if (TerrainUploader == null)
{
m_log.DebugFormat("Starting to receive uploaded terrain");
TerrainUploader = new EstateTerrainXferHandler(remote_client, clientFileName);
remote_client.OnXferReceive += TerrainUploader.XferReceive;
remote_client.OnAbortXfer += AbortTerrainXferHandler;
TerrainUploader.TerrainUploadDone += HandleTerrainApplication;
TerrainUploader.RequestStartXfer(remote_client);
}
else
{
remote_client.SendAlertMessage("Another Terrain Upload is in progress. Please wait your turn!");
}
TerrainUploader.RequestStartXfer(remote_client);
}
else
}
public bool IsTerrainXfer(ulong xferID)
{
lock (this)
{
remote_client.SendAlertMessage("Another Terrain Upload is in progress. Please wait your turn!");
if (TerrainUploader == null)
return false;
else
return TerrainUploader.XferID == xferID;
}
}

View File

@@ -78,7 +78,10 @@ namespace OpenSim.Region.CoreModules.World.Estate
/// <param name="data"></param>
public void XferReceive(IClientAPI remoteClient, ulong xferID, uint packetID, byte[] data)
{
if (mXferID == xferID)
if (mXferID != xferID)
return;
lock (this)
{
if (m_asset.Data.Length > 1)
{
@@ -99,7 +102,6 @@ namespace OpenSim.Region.CoreModules.World.Estate
if ((packetID & 0x80000000) != 0)
{
SendCompleteMessage(remoteClient);
}
}
}

View File

@@ -165,7 +165,16 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
regionimage = regionimage.Replace("-", "");
m_log.Info("[WORLD MAP]: JPEG Map location: " + m_scene.RegionInfo.ServerURI + "index.php?method=" + regionimage);
MainServer.Instance.AddHTTPHandler(regionimage, OnHTTPGetMapImage);
MainServer.Instance.AddHTTPHandler(regionimage,
new GenericHTTPDOSProtector(OnHTTPGetMapImage, OnHTTPThrottled, new BasicDosProtectorOptions()
{
AllowXForwardedFor = false,
ForgetTimeSpan = TimeSpan.FromMinutes(2),
MaxRequestsInTimeframe = 4,
ReportingName = "MAPDOSPROTECTOR",
RequestTimeSpan = TimeSpan.FromSeconds(10),
ThrottledAction = BasicDOSProtector.ThrottleAction.DoThrottledMethod
}).Process);
MainServer.Instance.AddLLSDHandler(
"/MAP/MapItems/" + m_scene.RegionInfo.RegionHandle.ToString(), HandleRemoteMapItemRequest);
@@ -1081,6 +1090,16 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
block.Y = (ushort)(r.RegionLocY / Constants.RegionSize);
}
public Hashtable OnHTTPThrottled(Hashtable keysvals)
{
Hashtable reply = new Hashtable();
int statuscode = 500;
reply["str_response_string"] = "";
reply["int_response_code"] = statuscode;
reply["content_type"] = "text/plain";
return reply;
}
public Hashtable OnHTTPGetMapImage(Hashtable keysvals)
{
m_log.Debug("[WORLD MAP]: Sending map image jpeg");