From 5b3897a4af247a14dfd36fa00bb6999e0a1078d5 Mon Sep 17 00:00:00 2001 From: lbsa71 Date: Mon, 25 Feb 2008 15:36:24 +0000 Subject: * Caught HttpListenerException and swallowed if with output * Moved Flush into Close since it's always done in that order. * Minor renamings * Reversed if for clarity --- OpenSim/Framework/Servers/BaseHttpServer.cs | 12 ++++++++-- OpenSim/Region/ClientStack/ClientView.cs | 22 +++++++++--------- OpenSim/Region/ClientStack/PacketQueue.cs | 4 +++- OpenSim/Region/Environment/Modules/ChatModule.cs | 1 - .../Modules/UserTextureDownloadService.cs | 26 +++++++++++----------- OpenSim/Region/Environment/Scenes/Scene.cs | 4 ++-- 6 files changed, 38 insertions(+), 31 deletions(-) diff --git a/OpenSim/Framework/Servers/BaseHttpServer.cs b/OpenSim/Framework/Servers/BaseHttpServer.cs index dc540f9..e61cc80 100644 --- a/OpenSim/Framework/Servers/BaseHttpServer.cs +++ b/OpenSim/Framework/Servers/BaseHttpServer.cs @@ -154,8 +154,16 @@ namespace OpenSim.Framework.Servers request.InputStream.Close(); response.ContentType = requestHandler.ContentType; response.ContentLength64 = buffer.LongLength; - response.OutputStream.Write(buffer, 0, buffer.Length); - response.OutputStream.Close(); + + try + { + response.OutputStream.Write(buffer, 0, buffer.Length); + response.OutputStream.Close(); + } + catch (HttpListenerException e) + { + m_log.InfoFormat("[BASEHTTPSERVER] Http request abnormally terminated."); + } } else { diff --git a/OpenSim/Region/ClientStack/ClientView.cs b/OpenSim/Region/ClientStack/ClientView.cs index 8220ae8..346bafc 100644 --- a/OpenSim/Region/ClientStack/ClientView.cs +++ b/OpenSim/Region/ClientStack/ClientView.cs @@ -336,7 +336,7 @@ namespace OpenSim.Region.ClientStack # region Client Methods - private void CloseCleanup(bool ShutdownCircult) + private void CloseCleanup(bool shutdownCircuit) { m_scene.RemoveClient(AgentId); @@ -347,10 +347,7 @@ namespace OpenSim.Region.ClientStack DisableSimulatorPacket disable = (DisableSimulatorPacket)PacketPool.Instance.GetPacket(PacketType.DisableSimulator); OutPacket(disable, ThrottleOutPacketType.Task); - - // FLUSH Packets m_packetQueue.Close(); - m_packetQueue.Flush(); Thread.Sleep(2000); @@ -370,7 +367,7 @@ namespace OpenSim.Region.ClientStack // If we're not shutting down the circuit, then this is the last time we'll go here. // If we are shutting down the circuit, the UDP Server will come back here with // ShutDownCircuit = false - if (!(ShutdownCircult)) + if (!(shutdownCircuit)) { GC.Collect(); m_clientThread.Abort(); @@ -381,17 +378,19 @@ namespace OpenSim.Region.ClientStack /// Close down the client view. This *must* be the last method called, since the last # /// statement of CloseCleanup() aborts the thread. /// - /// - public void Close(bool ShutdownCircult) + /// + public void Close(bool shutdownCircuit) { // Pull Client out of Region m_log.Info("[CLIENT]: Close has been called"); //raiseevent on the packet server to Shutdown the circuit - if (ShutdownCircult) + if (shutdownCircuit) + { OnConnectionClosed(this); + } - CloseCleanup(ShutdownCircult); + CloseCleanup(shutdownCircuit); } public void Kick(string message) @@ -503,7 +502,7 @@ namespace OpenSim.Region.ClientStack protected virtual void ClientLoop() { m_log.Info("[CLIENT]: Entered loop"); - while (true) + while( true ) { QueItem nextPacket = m_packetQueue.Dequeue(); if (nextPacket.Incoming) @@ -583,7 +582,6 @@ namespace OpenSim.Region.ClientStack { //session/circuit not authorised m_log.Info("[CLIENT]: New user request denied to " + m_userEndPoint.ToString()); - m_packetQueue.Flush(); m_packetQueue.Close(); m_clientThread.Abort(); } @@ -1082,7 +1080,7 @@ namespace OpenSim.Region.ClientStack StartPingCheckPacket pc = (StartPingCheckPacket)PacketPool.Instance.GetPacket(PacketType.StartPingCheck); pc.PingID.PingID = seq; pc.Header.Reliable = false; - OutPacket(pc, ThrottleOutPacketType.Task); + OutPacket(pc, ThrottleOutPacketType.Unknown); } public void SendKillObject(ulong regionHandle, uint localID) diff --git a/OpenSim/Region/ClientStack/PacketQueue.cs b/OpenSim/Region/ClientStack/PacketQueue.cs index 4673082..1a8450f 100644 --- a/OpenSim/Region/ClientStack/PacketQueue.cs +++ b/OpenSim/Region/ClientStack/PacketQueue.cs @@ -182,7 +182,7 @@ namespace OpenSim.Region.ClientStack return SendQueue.Dequeue(); } - public void Flush() + private void Flush() { lock (this) { @@ -224,6 +224,8 @@ namespace OpenSim.Region.ClientStack public void Close() { + Flush(); + m_enabled = false; throttleTimer.Stop(); diff --git a/OpenSim/Region/Environment/Modules/ChatModule.cs b/OpenSim/Region/Environment/Modules/ChatModule.cs index c146941..b118257 100644 --- a/OpenSim/Region/Environment/Modules/ChatModule.cs +++ b/OpenSim/Region/Environment/Modules/ChatModule.cs @@ -161,7 +161,6 @@ namespace OpenSim.Region.Environment.Modules } client.OnLogout += ClientLoggedOut; client.OnConnectionClosed += ClientLoggedOut; - //client.OnDisconnectUser += ClientLoggedOut; client.OnLogout += ClientLoggedOut; } catch (Exception ex) diff --git a/OpenSim/Region/Environment/Modules/UserTextureDownloadService.cs b/OpenSim/Region/Environment/Modules/UserTextureDownloadService.cs index 1ac6ad2..c325746 100644 --- a/OpenSim/Region/Environment/Modules/UserTextureDownloadService.cs +++ b/OpenSim/Region/Environment/Modules/UserTextureDownloadService.cs @@ -115,7 +115,7 @@ namespace OpenSim.Region.Environment.Modules /// texture sender for processing. /// /// - /// + /// public void TextureCallback(LLUUID textureID, AssetBase texture) { lock (m_textureSenders) @@ -124,25 +124,25 @@ namespace OpenSim.Region.Environment.Modules if (m_textureSenders.TryGetValue(textureID, out textureSender)) { - if (null != texture) - { - if (!textureSender.ImageLoaded) - { - textureSender.TextureReceived(texture); - EnqueueTextureSender(textureSender); - } - } - else + if (texture == null) { // Right now, leaving it up to lower level asset server code to post the fact that // this texture could not be found - + // TODO Send packet back to the client telling it not to expect the texture - + //m_log.DebugFormat("[USER TEXTURE DOWNLOAD]: Removing download stat for {0}", textureID); m_scene.AddPendingDownloads(-1); } - + else + { + if (!textureSender.ImageLoaded) + { + textureSender.TextureReceived(texture); + EnqueueTextureSender(textureSender); + } + } + //m_log.InfoFormat("[TEXTURE SENDER] Removing texture sender with uuid {0}", textureID); m_textureSenders.Remove(textureID); //m_log.InfoFormat("[TEXTURE SENDER] Current texture senders in dictionary: {0}", m_textureSenders.Count); diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs index 4f44d36..1088fc1 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.cs @@ -1397,7 +1397,7 @@ namespace OpenSim.Region.Environment.Scenes client.OnRegionInfoRequest += m_estateManager.HandleRegionInfoRequest; client.OnEstateCovenantRequest += m_estateManager.HandleEstateCovenantRequest; client.OnRequestGodlikePowers += handleRequestGodlikePowers; - client.OnGodKickUser += handleGodlikeKickUser; + client.OnGodKickUser += HandleGodlikeKickUser; client.OnObjectPermissions += HandleObjectPermissionsUpdate; client.OnCreateNewInventoryItem += CreateNewInventoryItem; @@ -2188,7 +2188,7 @@ namespace OpenSim.Region.Environment.Scenes /// the person that is being kicked /// This isn't used apparently /// The message to send to the user after it's been turned into a field - public void handleGodlikeKickUser(LLUUID godID, LLUUID sessionID, LLUUID agentID, uint kickflags, byte[] reason) + public void HandleGodlikeKickUser(LLUUID godID, LLUUID sessionID, LLUUID agentID, uint kickflags, byte[] reason) { // For some reason the client sends this seemingly hard coded UUID for kicking everyone. Dun-know. LLUUID kickUserID = new LLUUID("44e87126e7944ded05b37c42da3d5cdb"); -- cgit v1.1