aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs75
1 files changed, 64 insertions, 11 deletions
diff --git a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs
index 6f10f51..959829c 100644
--- a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs
+++ b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs
@@ -1060,27 +1060,80 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
1060 /// <param name="maxY"></param> 1060 /// <param name="maxY"></param>
1061 public void RequestMapBlocks(IClientAPI remoteClient, int minX, int minY, int maxX, int maxY, uint flag) 1061 public void RequestMapBlocks(IClientAPI remoteClient, int minX, int minY, int maxX, int maxY, uint flag)
1062 { 1062 {
1063 m_log.DebugFormat("[WoldMapModule] RequestMapBlocks {0}={1}={2}={3} {4}", minX, minY, maxX, maxY, flag); 1063// m_log.DebugFormat("[WoldMapModule] RequestMapBlocks {0}={1}={2}={3} {4}", minX, minY, maxX, maxY, flag);
1064 1064
1065 GetAndSendBlocks(remoteClient, minX, minY, maxX, maxY, flag); 1065 GetAndSendBlocks(remoteClient, minX, minY, maxX, maxY, flag);
1066 } 1066 }
1067 1067
1068 private const double SPAMBLOCKTIMEms = 300000; // 5 minutes
1069 private Dictionary<UUID,double> spamBlocked = new Dictionary<UUID,double>();
1070
1068 protected virtual List<MapBlockData> GetAndSendBlocks(IClientAPI remoteClient, int minX, int minY, int maxX, int maxY, uint flag) 1071 protected virtual List<MapBlockData> GetAndSendBlocks(IClientAPI remoteClient, int minX, int minY, int maxX, int maxY, uint flag)
1069 { 1072 {
1070 MapBlockRequestData req = new MapBlockRequestData(); 1073 // anti spam because of FireStorm 4.7.7 absurd request repeat rates
1074 // possible others
1071 1075
1072 req.client = remoteClient; 1076 double now = Util.GetTimeStampMS();
1073 req.minX = minX; 1077 UUID agentID = remoteClient.AgentId;
1074 req.maxX = maxX;
1075 req.minY = minY;
1076 req.maxY = maxY;
1077 req.flags = flag;
1078 1078
1079 lock (m_mapBlockRequestEvent) 1079 lock (m_mapBlockRequestEvent)
1080 { 1080 {
1081 if (!m_mapBlockRequests.ContainsKey(remoteClient.AgentId)) 1081 if(spamBlocked.ContainsKey(agentID))
1082 m_mapBlockRequests[remoteClient.AgentId] = new Queue<MapBlockRequestData>(); 1082 {
1083 m_mapBlockRequests[remoteClient.AgentId].Enqueue(req); 1083 if(spamBlocked[agentID] < now &&
1084 (!m_mapBlockRequests.ContainsKey(agentID) ||
1085 m_mapBlockRequests[agentID].Count == 0 ))
1086 {
1087 spamBlocked.Remove(agentID);
1088 m_log.DebugFormat("[WoldMapModule] RequestMapBlocks release spammer {0}", agentID);
1089 }
1090 else
1091 return new List<MapBlockData>();
1092 }
1093 else
1094 {
1095 // ugly slow expire spammers
1096 if(spamBlocked.Count > 0)
1097 {
1098 UUID k = UUID.Zero;
1099 bool expireone = false;
1100 foreach(UUID k2 in spamBlocked.Keys)
1101 {
1102 if(spamBlocked[k2] < now &&
1103 (!m_mapBlockRequests.ContainsKey(k2) ||
1104 m_mapBlockRequests[k2].Count == 0 ))
1105 {
1106 m_log.DebugFormat("[WoldMapModule] RequestMapBlocks release spammer {0}", k2);
1107 k = k2;
1108 expireone = true;
1109 }
1110 break; // doing one at a time
1111 }
1112 if(expireone)
1113 spamBlocked.Remove(k);
1114 }
1115 }
1116
1117// m_log.DebugFormat("[WoldMapModule] RequestMapBlocks {0}={1}={2}={3} {4}", minX, minY, maxX, maxY, flag);
1118
1119 MapBlockRequestData req = new MapBlockRequestData();
1120
1121 req.client = remoteClient;
1122 req.minX = minX;
1123 req.maxX = maxX;
1124 req.minY = minY;
1125 req.maxY = maxY;
1126 req.flags = flag;
1127
1128 if (!m_mapBlockRequests.ContainsKey(agentID))
1129 m_mapBlockRequests[agentID] = new Queue<MapBlockRequestData>();
1130 if(m_mapBlockRequests[agentID].Count < 150 )
1131 m_mapBlockRequests[agentID].Enqueue(req);
1132 else
1133 {
1134 spamBlocked[agentID] = now + SPAMBLOCKTIMEms;
1135 m_log.DebugFormat("[WoldMapModule] RequestMapBlocks blocking spammer {0} for {1} s",agentID, SPAMBLOCKTIMEms/1000.0);
1136 }
1084 m_mapBlockRequestEvent.Set(); 1137 m_mapBlockRequestEvent.Set();
1085 } 1138 }
1086 1139