clean up better on QUIT

git-svn-id: svn://anubis/gvsu@47 45c1a28c-8058-47b2-ae61-ca45b979098e
This commit is contained in:
josh 2008-03-09 00:08:55 +00:00
parent a896509598
commit 438f7aee8f

View File

@ -108,7 +108,8 @@ public class KaZaServer implements Runnable
m_socket.getOutputStream()); m_socket.getOutputStream());
/* loop processing client messages */ /* loop processing client messages */
for (;;) boolean running = true;
while (running)
{ {
String inLine = br.readLine(); String inLine = br.readLine();
@ -172,17 +173,21 @@ public class KaZaServer implements Runnable
else if (opCode.equals("QUIT")) else if (opCode.equals("QUIT"))
{ {
/* user is requesting to leave the system */ /* user is requesting to leave the system */
synchronized (m_clientData)
{
m_clientData.remove(m_clientIP);
br.close(); br.close();
os.close(); os.close();
m_socket.close(); m_socket.close();
return; running = false;
} }
} }
} }
} catch (Exception e) { } catch (Exception e) { }
finally
{
synchronized (m_clientData)
{
m_clientData.remove(m_clientIP);
}
}
} }
} }