diff options
author | Melanie | 2012-09-10 13:53:00 +0100 |
---|---|---|
committer | Melanie | 2012-09-10 13:53:00 +0100 |
commit | 21c476228a1dbeef1f180a16e9ebb47c8b3fa185 (patch) | |
tree | 5a2fc5d269eb4711fa2ace11d04731e7dc08607b /OpenSim/Region/ClientStack/Linden | |
parent | Merge branch 'master' into careminster (diff) | |
parent | Remove commented code (diff) | |
download | opensim-SC-21c476228a1dbeef1f180a16e9ebb47c8b3fa185.zip opensim-SC-21c476228a1dbeef1f180a16e9ebb47c8b3fa185.tar.gz opensim-SC-21c476228a1dbeef1f180a16e9ebb47c8b3fa185.tar.bz2 opensim-SC-21c476228a1dbeef1f180a16e9ebb47c8b3fa185.tar.xz |
Merge branch 'avination' into careminster
Diffstat (limited to 'OpenSim/Region/ClientStack/Linden')
3 files changed, 87 insertions, 23 deletions
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueHelper.cs b/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueHelper.cs index b9222e3..7dcf137 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueHelper.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueHelper.cs | |||
@@ -151,6 +151,12 @@ namespace OpenSim.Region.ClientStack.Linden | |||
151 | ulong regionHandle, byte simAccess, IPEndPoint regionExternalEndPoint, | 151 | ulong regionHandle, byte simAccess, IPEndPoint regionExternalEndPoint, |
152 | uint locationID, uint flags, string capsURL, UUID agentID) | 152 | uint locationID, uint flags, string capsURL, UUID agentID) |
153 | { | 153 | { |
154 | // not sure why flags get overwritten here | ||
155 | if ((flags & (uint)TeleportFlags.IsFlying) != 0) | ||
156 | flags = (uint)TeleportFlags.ViaLocation | (uint)TeleportFlags.IsFlying; | ||
157 | else | ||
158 | flags = (uint)TeleportFlags.ViaLocation; | ||
159 | |||
154 | OSDMap info = new OSDMap(); | 160 | OSDMap info = new OSDMap(); |
155 | info.Add("AgentID", OSD.FromUUID(agentID)); | 161 | info.Add("AgentID", OSD.FromUUID(agentID)); |
156 | info.Add("LocationID", OSD.FromInteger(4)); // TODO what is this? | 162 | info.Add("LocationID", OSD.FromInteger(4)); // TODO what is this? |
@@ -159,7 +165,8 @@ namespace OpenSim.Region.ClientStack.Linden | |||
159 | info.Add("SimAccess", OSD.FromInteger(simAccess)); | 165 | info.Add("SimAccess", OSD.FromInteger(simAccess)); |
160 | info.Add("SimIP", OSD.FromBinary(regionExternalEndPoint.Address.GetAddressBytes())); | 166 | info.Add("SimIP", OSD.FromBinary(regionExternalEndPoint.Address.GetAddressBytes())); |
161 | info.Add("SimPort", OSD.FromInteger(regionExternalEndPoint.Port)); | 167 | info.Add("SimPort", OSD.FromInteger(regionExternalEndPoint.Port)); |
162 | info.Add("TeleportFlags", OSD.FromULong(1L << 4)); // AgentManager.TeleportFlags.ViaLocation | 168 | // info.Add("TeleportFlags", OSD.FromULong(1L << 4)); // AgentManager.TeleportFlags.ViaLocation |
169 | info.Add("TeleportFlags", OSD.FromUInteger(flags)); | ||
163 | 170 | ||
164 | OSDArray infoArr = new OSDArray(); | 171 | OSDArray infoArr = new OSDArray(); |
165 | infoArr.Add(info); | 172 | infoArr.Add(info); |
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/WebFetchInvDescModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/WebFetchInvDescModule.cs index b77ead3..e996fe8 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/WebFetchInvDescModule.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/WebFetchInvDescModule.cs | |||
@@ -60,11 +60,11 @@ namespace OpenSim.Region.ClientStack.Linden | |||
60 | 60 | ||
61 | private WebFetchInvDescHandler m_webFetchHandler; | 61 | private WebFetchInvDescHandler m_webFetchHandler; |
62 | 62 | ||
63 | private ManualResetEvent m_ev = new ManualResetEvent(true); | ||
64 | private object m_lock = new object(); | 63 | private object m_lock = new object(); |
65 | 64 | ||
66 | private Dictionary<UUID, string> m_capsDict = new Dictionary<UUID, string>(); | 65 | private Dictionary<UUID, string> m_capsDict = new Dictionary<UUID, string>(); |
67 | private Dictionary<UUID, Hashtable> m_requests = new Dictionary<UUID, Hashtable>(); | 66 | private Dictionary<UUID, Hashtable> m_requests = new Dictionary<UUID, Hashtable>(); |
67 | bool m_busy = false; | ||
68 | 68 | ||
69 | #region ISharedRegionModule Members | 69 | #region ISharedRegionModule Members |
70 | 70 | ||
@@ -116,7 +116,9 @@ namespace OpenSim.Region.ClientStack.Linden | |||
116 | string capUrl = "/CAPS/" + UUID.Random() + "/"; | 116 | string capUrl = "/CAPS/" + UUID.Random() + "/"; |
117 | 117 | ||
118 | // Register this as a poll service | 118 | // Register this as a poll service |
119 | // absurd large timeout to tune later to make a bit less than viewer | ||
119 | PollServiceEventArgs args = new PollServiceEventArgs(HttpRequestHandler, HasEvents, GetEvents, NoEvents, agentID, 300000); | 120 | PollServiceEventArgs args = new PollServiceEventArgs(HttpRequestHandler, HasEvents, GetEvents, NoEvents, agentID, 300000); |
121 | |||
120 | args.Type = PollServiceEventArgs.EventType.Inventory; | 122 | args.Type = PollServiceEventArgs.EventType.Inventory; |
121 | MainServer.Instance.AddPollServiceHTTPHandler(capUrl, args); | 123 | MainServer.Instance.AddPollServiceHTTPHandler(capUrl, args); |
122 | 124 | ||
@@ -133,6 +135,8 @@ namespace OpenSim.Region.ClientStack.Linden | |||
133 | caps.RegisterHandler("FetchInventoryDescendents2", String.Format("{0}://{1}:{2}{3}", protocol, hostName, port, capUrl)); | 135 | caps.RegisterHandler("FetchInventoryDescendents2", String.Format("{0}://{1}:{2}{3}", protocol, hostName, port, capUrl)); |
134 | 136 | ||
135 | m_capsDict[agentID] = capUrl; | 137 | m_capsDict[agentID] = capUrl; |
138 | |||
139 | m_busy = false; | ||
136 | } | 140 | } |
137 | 141 | ||
138 | private void DeregisterCaps(UUID agentID, Caps caps) | 142 | private void DeregisterCaps(UUID agentID, Caps caps) |
@@ -149,25 +153,22 @@ namespace OpenSim.Region.ClientStack.Linden | |||
149 | public void HttpRequestHandler(UUID requestID, Hashtable request) | 153 | public void HttpRequestHandler(UUID requestID, Hashtable request) |
150 | { | 154 | { |
151 | // m_log.DebugFormat("[FETCH2]: Received request {0}", requestID); | 155 | // m_log.DebugFormat("[FETCH2]: Received request {0}", requestID); |
152 | m_requests[requestID] = request; | 156 | lock(m_lock) |
157 | m_requests[requestID] = request; | ||
153 | } | 158 | } |
154 | 159 | ||
155 | private bool HasEvents(UUID requestID, UUID sessionID) | 160 | private bool HasEvents(UUID requestID, UUID sessionID) |
156 | { | 161 | { |
157 | lock (m_lock) | 162 | lock (m_lock) |
158 | { | 163 | { |
159 | if (m_ev.WaitOne(0)) | 164 | return !m_busy; |
160 | { | ||
161 | m_ev.Reset(); | ||
162 | return true; | ||
163 | } | ||
164 | return false; | ||
165 | } | 165 | } |
166 | } | 166 | } |
167 | 167 | ||
168 | private Hashtable NoEvents(UUID requestID, UUID sessionID) | 168 | private Hashtable NoEvents(UUID requestID, UUID sessionID) |
169 | { | 169 | { |
170 | m_requests.Remove(requestID); | 170 | lock(m_lock) |
171 | m_requests.Remove(requestID); | ||
171 | 172 | ||
172 | Hashtable response = new Hashtable(); | 173 | Hashtable response = new Hashtable(); |
173 | 174 | ||
@@ -177,11 +178,17 @@ namespace OpenSim.Region.ClientStack.Linden | |||
177 | response["keepalive"] = false; | 178 | response["keepalive"] = false; |
178 | response["reusecontext"] = false; | 179 | response["reusecontext"] = false; |
179 | 180 | ||
181 | lock (m_lock) | ||
182 | m_busy = false; | ||
183 | |||
180 | return response; | 184 | return response; |
181 | } | 185 | } |
182 | 186 | ||
183 | private Hashtable GetEvents(UUID requestID, UUID sessionID, string request) | 187 | private Hashtable GetEvents(UUID requestID, UUID sessionID, string request) |
184 | { | 188 | { |
189 | lock (m_lock) | ||
190 | m_busy = true; | ||
191 | |||
185 | Hashtable response = new Hashtable(); | 192 | Hashtable response = new Hashtable(); |
186 | 193 | ||
187 | response["int_response_code"] = 500; | 194 | response["int_response_code"] = 500; |
@@ -192,20 +199,23 @@ namespace OpenSim.Region.ClientStack.Linden | |||
192 | 199 | ||
193 | try | 200 | try |
194 | { | 201 | { |
202 | |||
195 | Hashtable requestHash; | 203 | Hashtable requestHash; |
196 | if (!m_requests.TryGetValue(requestID, out requestHash)) | 204 | lock (m_lock) |
197 | { | 205 | { |
198 | lock (m_lock) | 206 | if (!m_requests.TryGetValue(requestID, out requestHash)) |
199 | m_ev.Set(); | 207 | { |
200 | response["str_response_string"] = "Invalid request"; | 208 | m_busy = false; |
201 | return response; | 209 | response["str_response_string"] = "Invalid request"; |
210 | return response; | ||
211 | } | ||
212 | m_requests.Remove(requestID); | ||
202 | } | 213 | } |
203 | 214 | ||
204 | // m_log.DebugFormat("[FETCH2]: Processed request {0}", requestID); | 215 | // m_log.DebugFormat("[FETCH2]: Processed request {0}", requestID); |
205 | 216 | ||
206 | string reply = m_webFetchHandler.FetchInventoryDescendentsRequest(requestHash["body"].ToString(), String.Empty, String.Empty, null, null); | 217 | string reply = m_webFetchHandler.FetchInventoryDescendentsRequest(requestHash["body"].ToString(), String.Empty, String.Empty, null, null); |
207 | 218 | ||
208 | m_requests.Remove(requestID); | ||
209 | 219 | ||
210 | response["int_response_code"] = 200; | 220 | response["int_response_code"] = 200; |
211 | response["str_response_string"] = reply; | 221 | response["str_response_string"] = reply; |
@@ -213,7 +223,7 @@ namespace OpenSim.Region.ClientStack.Linden | |||
213 | finally | 223 | finally |
214 | { | 224 | { |
215 | lock (m_lock) | 225 | lock (m_lock) |
216 | m_ev.Set(); | 226 | m_busy = false; |
217 | } | 227 | } |
218 | 228 | ||
219 | return response; | 229 | return response; |
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 7e51638..74b27d7 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | |||
@@ -807,7 +807,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
807 | handshake.RegionInfo3.ProductName = Util.StringToBytes256(regionInfo.RegionType); | 807 | handshake.RegionInfo3.ProductName = Util.StringToBytes256(regionInfo.RegionType); |
808 | handshake.RegionInfo3.ProductSKU = Utils.EmptyBytes; | 808 | handshake.RegionInfo3.ProductSKU = Utils.EmptyBytes; |
809 | 809 | ||
810 | OutPacket(handshake, ThrottleOutPacketType.Task); | 810 | // OutPacket(handshake, ThrottleOutPacketType.Task); |
811 | // use same as MoveAgentIntoRegion (both should be task ) | ||
812 | OutPacket(handshake, ThrottleOutPacketType.Unknown); | ||
811 | } | 813 | } |
812 | 814 | ||
813 | public void MoveAgentIntoRegion(RegionInfo regInfo, Vector3 pos, Vector3 look) | 815 | public void MoveAgentIntoRegion(RegionInfo regInfo, Vector3 pos, Vector3 look) |
@@ -8748,16 +8750,61 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
8748 | 8750 | ||
8749 | #region Parcel related packets | 8751 | #region Parcel related packets |
8750 | 8752 | ||
8753 | // acumulate several HandleRegionHandleRequest consecutive overlaping requests | ||
8754 | // to be done with minimal resources as possible | ||
8755 | // variables temporary here while in test | ||
8756 | |||
8757 | Queue<UUID> RegionHandleRequests = new Queue<UUID>(); | ||
8758 | bool RegionHandleRequestsInService = false; | ||
8759 | |||
8751 | private bool HandleRegionHandleRequest(IClientAPI sender, Packet Pack) | 8760 | private bool HandleRegionHandleRequest(IClientAPI sender, Packet Pack) |
8752 | { | 8761 | { |
8753 | RegionHandleRequestPacket rhrPack = (RegionHandleRequestPacket)Pack; | 8762 | UUID currentUUID; |
8754 | 8763 | ||
8755 | RegionHandleRequest handlerRegionHandleRequest = OnRegionHandleRequest; | 8764 | RegionHandleRequest handlerRegionHandleRequest = OnRegionHandleRequest; |
8756 | if (handlerRegionHandleRequest != null) | 8765 | |
8766 | if (handlerRegionHandleRequest == null) | ||
8767 | return true; | ||
8768 | |||
8769 | RegionHandleRequestPacket rhrPack = (RegionHandleRequestPacket)Pack; | ||
8770 | |||
8771 | lock (RegionHandleRequests) | ||
8772 | { | ||
8773 | if (RegionHandleRequestsInService) | ||
8774 | { | ||
8775 | // we are already busy doing a previus request | ||
8776 | // so enqueue it | ||
8777 | RegionHandleRequests.Enqueue(rhrPack.RequestBlock.RegionID); | ||
8778 | return true; | ||
8779 | } | ||
8780 | |||
8781 | // else do it | ||
8782 | currentUUID = rhrPack.RequestBlock.RegionID; | ||
8783 | RegionHandleRequestsInService = true; | ||
8784 | } | ||
8785 | |||
8786 | while (true) | ||
8757 | { | 8787 | { |
8758 | handlerRegionHandleRequest(this, rhrPack.RequestBlock.RegionID); | 8788 | handlerRegionHandleRequest(this, currentUUID); |
8789 | |||
8790 | lock (RegionHandleRequests) | ||
8791 | { | ||
8792 | // exit condition, nothing to do or closed | ||
8793 | // current code seems to assume we may loose the handler at anytime, | ||
8794 | // so keep checking it | ||
8795 | handlerRegionHandleRequest = OnRegionHandleRequest; | ||
8796 | |||
8797 | if (RegionHandleRequests.Count == 0 || !IsActive || handlerRegionHandleRequest == null) | ||
8798 | { | ||
8799 | RegionHandleRequests.Clear(); | ||
8800 | RegionHandleRequestsInService = false; | ||
8801 | return true; | ||
8802 | } | ||
8803 | currentUUID = RegionHandleRequests.Dequeue(); | ||
8804 | } | ||
8759 | } | 8805 | } |
8760 | return true; | 8806 | |
8807 | return true; // actually unreached | ||
8761 | } | 8808 | } |
8762 | 8809 | ||
8763 | private bool HandleParcelInfoRequest(IClientAPI sender, Packet Pack) | 8810 | private bool HandleParcelInfoRequest(IClientAPI sender, Packet Pack) |