File tree Expand file tree Collapse file tree
src/net/tootallnate/websocket Expand file tree Collapse file tree Original file line number Diff line number Diff line change 33import java .io .IOException ;
44import java .net .InetSocketAddress ;
55import java .net .URI ;
6+ import java .nio .channels .ClosedByInterruptException ;
67import java .nio .channels .NotYetConnectedException ;
78import java .nio .channels .SelectionKey ;
89import java .nio .channels .Selector ;
@@ -132,7 +133,11 @@ private void tryToConnect( InetSocketAddress remote ) throws IOException {
132133 public void run () {
133134 try {
134135 tryToConnect ( new InetSocketAddress ( uri .getHost (), getPort () ) );
135- } catch ( IOException e ) {//
136+ }
137+ catch (ClosedByInterruptException e ) {
138+ onError ( null , e );
139+ return ;
140+ }catch ( IOException e ) {//
136141 onError ( conn , e );
137142 conn .close ();
138143 return ;
@@ -156,6 +161,9 @@ public void run() {
156161 if ( key .isReadable () ) {
157162 conn .handleRead ();
158163 }
164+ if (!key .isValid ()){
165+ continue ;
166+ }
159167 if ( key .isWritable () ) {
160168 conn .handleWrite ();
161169 }
You can’t perform that action at this time.
0 commit comments