* 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
0.6.0-stable
lbsa71 2008-02-25 15:36:24 +00:00
parent cda8b013ec
commit 5b3897a4af
6 changed files with 38 additions and 31 deletions

View File

@ -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
{

View File

@ -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.
/// </summary>
/// <param name="ShutdownCircult"></param>
public void Close(bool ShutdownCircult)
/// <param name="shutdownCircuit"></param>
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)

View File

@ -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();

View File

@ -161,7 +161,6 @@ namespace OpenSim.Region.Environment.Modules
}
client.OnLogout += ClientLoggedOut;
client.OnConnectionClosed += ClientLoggedOut;
//client.OnDisconnectUser += ClientLoggedOut;
client.OnLogout += ClientLoggedOut;
}
catch (Exception ex)

View File

@ -115,7 +115,7 @@ namespace OpenSim.Region.Environment.Modules
/// texture sender for processing.
/// </summary>
/// <param name="textureID"></param>
/// <param name="asset"></param>
/// <param name="texture"></param>
public void TextureCallback(LLUUID textureID, AssetBase texture)
{
lock (m_textureSenders)
@ -124,7 +124,17 @@ namespace OpenSim.Region.Environment.Modules
if (m_textureSenders.TryGetValue(textureID, out textureSender))
{
if (null != texture)
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)
{
@ -132,17 +142,7 @@ namespace OpenSim.Region.Environment.Modules
EnqueueTextureSender(textureSender);
}
}
else
{
// 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);
}
//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);

View File

@ -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
/// <param name="agentID">the person that is being kicked</param>
/// <param name="kickflags">This isn't used apparently</param>
/// <param name="reason">The message to send to the user after it's been turned into a field</param>
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");