* 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(); request.InputStream.Close();
response.ContentType = requestHandler.ContentType; response.ContentType = requestHandler.ContentType;
response.ContentLength64 = buffer.LongLength; 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 else
{ {

View File

@ -336,7 +336,7 @@ namespace OpenSim.Region.ClientStack
# region Client Methods # region Client Methods
private void CloseCleanup(bool ShutdownCircult) private void CloseCleanup(bool shutdownCircuit)
{ {
m_scene.RemoveClient(AgentId); m_scene.RemoveClient(AgentId);
@ -347,10 +347,7 @@ namespace OpenSim.Region.ClientStack
DisableSimulatorPacket disable = (DisableSimulatorPacket)PacketPool.Instance.GetPacket(PacketType.DisableSimulator); DisableSimulatorPacket disable = (DisableSimulatorPacket)PacketPool.Instance.GetPacket(PacketType.DisableSimulator);
OutPacket(disable, ThrottleOutPacketType.Task); OutPacket(disable, ThrottleOutPacketType.Task);
// FLUSH Packets
m_packetQueue.Close(); m_packetQueue.Close();
m_packetQueue.Flush();
Thread.Sleep(2000); 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'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 // If we are shutting down the circuit, the UDP Server will come back here with
// ShutDownCircuit = false // ShutDownCircuit = false
if (!(ShutdownCircult)) if (!(shutdownCircuit))
{ {
GC.Collect(); GC.Collect();
m_clientThread.Abort(); 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 # /// Close down the client view. This *must* be the last method called, since the last #
/// statement of CloseCleanup() aborts the thread. /// statement of CloseCleanup() aborts the thread.
/// </summary> /// </summary>
/// <param name="ShutdownCircult"></param> /// <param name="shutdownCircuit"></param>
public void Close(bool ShutdownCircult) public void Close(bool shutdownCircuit)
{ {
// Pull Client out of Region // Pull Client out of Region
m_log.Info("[CLIENT]: Close has been called"); m_log.Info("[CLIENT]: Close has been called");
//raiseevent on the packet server to Shutdown the circuit //raiseevent on the packet server to Shutdown the circuit
if (ShutdownCircult) if (shutdownCircuit)
{
OnConnectionClosed(this); OnConnectionClosed(this);
}
CloseCleanup(ShutdownCircult); CloseCleanup(shutdownCircuit);
} }
public void Kick(string message) public void Kick(string message)
@ -503,7 +502,7 @@ namespace OpenSim.Region.ClientStack
protected virtual void ClientLoop() protected virtual void ClientLoop()
{ {
m_log.Info("[CLIENT]: Entered loop"); m_log.Info("[CLIENT]: Entered loop");
while (true) while( true )
{ {
QueItem nextPacket = m_packetQueue.Dequeue(); QueItem nextPacket = m_packetQueue.Dequeue();
if (nextPacket.Incoming) if (nextPacket.Incoming)
@ -583,7 +582,6 @@ namespace OpenSim.Region.ClientStack
{ {
//session/circuit not authorised //session/circuit not authorised
m_log.Info("[CLIENT]: New user request denied to " + m_userEndPoint.ToString()); m_log.Info("[CLIENT]: New user request denied to " + m_userEndPoint.ToString());
m_packetQueue.Flush();
m_packetQueue.Close(); m_packetQueue.Close();
m_clientThread.Abort(); m_clientThread.Abort();
} }
@ -1082,7 +1080,7 @@ namespace OpenSim.Region.ClientStack
StartPingCheckPacket pc = (StartPingCheckPacket)PacketPool.Instance.GetPacket(PacketType.StartPingCheck); StartPingCheckPacket pc = (StartPingCheckPacket)PacketPool.Instance.GetPacket(PacketType.StartPingCheck);
pc.PingID.PingID = seq; pc.PingID.PingID = seq;
pc.Header.Reliable = false; pc.Header.Reliable = false;
OutPacket(pc, ThrottleOutPacketType.Task); OutPacket(pc, ThrottleOutPacketType.Unknown);
} }
public void SendKillObject(ulong regionHandle, uint localID) public void SendKillObject(ulong regionHandle, uint localID)

View File

@ -182,7 +182,7 @@ namespace OpenSim.Region.ClientStack
return SendQueue.Dequeue(); return SendQueue.Dequeue();
} }
public void Flush() private void Flush()
{ {
lock (this) lock (this)
{ {
@ -224,6 +224,8 @@ namespace OpenSim.Region.ClientStack
public void Close() public void Close()
{ {
Flush();
m_enabled = false; m_enabled = false;
throttleTimer.Stop(); throttleTimer.Stop();

View File

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

View File

@ -115,7 +115,7 @@ namespace OpenSim.Region.Environment.Modules
/// texture sender for processing. /// texture sender for processing.
/// </summary> /// </summary>
/// <param name="textureID"></param> /// <param name="textureID"></param>
/// <param name="asset"></param> /// <param name="texture"></param>
public void TextureCallback(LLUUID textureID, AssetBase texture) public void TextureCallback(LLUUID textureID, AssetBase texture)
{ {
lock (m_textureSenders) lock (m_textureSenders)
@ -124,7 +124,17 @@ namespace OpenSim.Region.Environment.Modules
if (m_textureSenders.TryGetValue(textureID, out textureSender)) 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) if (!textureSender.ImageLoaded)
{ {
@ -132,17 +142,7 @@ namespace OpenSim.Region.Environment.Modules
EnqueueTextureSender(textureSender); 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_log.InfoFormat("[TEXTURE SENDER] Removing texture sender with uuid {0}", textureID);
m_textureSenders.Remove(textureID); m_textureSenders.Remove(textureID);
//m_log.InfoFormat("[TEXTURE SENDER] Current texture senders in dictionary: {0}", m_textureSenders.Count); //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.OnRegionInfoRequest += m_estateManager.HandleRegionInfoRequest;
client.OnEstateCovenantRequest += m_estateManager.HandleEstateCovenantRequest; client.OnEstateCovenantRequest += m_estateManager.HandleEstateCovenantRequest;
client.OnRequestGodlikePowers += handleRequestGodlikePowers; client.OnRequestGodlikePowers += handleRequestGodlikePowers;
client.OnGodKickUser += handleGodlikeKickUser; client.OnGodKickUser += HandleGodlikeKickUser;
client.OnObjectPermissions += HandleObjectPermissionsUpdate; client.OnObjectPermissions += HandleObjectPermissionsUpdate;
client.OnCreateNewInventoryItem += CreateNewInventoryItem; client.OnCreateNewInventoryItem += CreateNewInventoryItem;
@ -2188,7 +2188,7 @@ namespace OpenSim.Region.Environment.Scenes
/// <param name="agentID">the person that is being kicked</param> /// <param name="agentID">the person that is being kicked</param>
/// <param name="kickflags">This isn't used apparently</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> /// <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. // For some reason the client sends this seemingly hard coded UUID for kicking everyone. Dun-know.
LLUUID kickUserID = new LLUUID("44e87126e7944ded05b37c42da3d5cdb"); LLUUID kickUserID = new LLUUID("44e87126e7944ded05b37c42da3d5cdb");