fixed a bug that left sockets in the CLOSE_WAIT state
authoradam <adam@megacz.com>
Sun, 12 Sep 2004 02:07:38 +0000 (02:07 +0000)
committeradam <adam@megacz.com>
Sun, 12 Sep 2004 02:07:38 +0000 (02:07 +0000)
darcs-hash:20040912020738-5007d-9436a59ca8e04d36aef886c460e03330f4b41d9b.gz

src/org/ibex/io/Connection.java
src/org/ibex/io/Stream.java

index bb7907b..4233315 100644 (file)
@@ -10,6 +10,7 @@ public class Connection extends Stream {
     private final Socket s;
     public final String vhost;
     public Connection(Socket s, String vhost) { super(s); this.vhost = vhost; this.s = s; }
+    public void close()                       { try{s.close();}catch(Exception e){throw new StreamException(e);} super.close(); }
     public int getLocalPort()                 { return s.getLocalPort(); }
     public int getRemotePort()                { return s.getPort(); }
     public InetAddress getRemoteAddress()     { return ((InetSocketAddress)s.getRemoteSocketAddress()).getAddress(); }
index ef6c5a8..9de0322 100644 (file)
@@ -57,7 +57,7 @@ public class Stream {
     public void   println(String s)                { logWrite(s); out.write(s); out.write(newLine); flush(); }
 
     public void   flush()                          { if (out != null) try { out.w.flush(); } catch(IOException e) { ioe(e); } }
-    public void   close()                          { in.close(); out.close(); }
+    public void   close()                          { try { in.close(); } finally { out.close(); } }
     public void   setNewline(String s)             { newLine = s; }