Skip to content

Commit a7644a0

Browse files
committed
1 parent a9e4754 commit a7644a0

File tree

1 file changed

+16
-16
lines changed

1 file changed

+16
-16
lines changed

src/org/java_websocket/client/WebSocketClient.java

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -187,10 +187,25 @@ public void run() {
187187
if( thread == null )
188188
thread = Thread.currentThread();
189189
interruptableRun();
190+
191+
try {
192+
selector.close();
193+
} catch ( IOException e ) {
194+
onError( e );
195+
}
196+
closelock.lock();
197+
selector = null;
198+
closelock.unlock();
199+
try {
200+
channel.close();
201+
} catch ( IOException e ) {
202+
onError( e );
203+
}
204+
channel = null;
190205
thread = null;
191206
}
192207

193-
protected final void interruptableRun() {
208+
private final void interruptableRun() {
194209
try {
195210
tryToConnect( new InetSocketAddress( uri.getHost(), getPort() ) );
196211
} catch ( ClosedByInterruptException e ) {
@@ -247,21 +262,6 @@ protected final void interruptableRun() {
247262
onError( e );
248263
conn.eot( e );
249264
}
250-
251-
try {
252-
selector.close();
253-
} catch ( IOException e ) {
254-
onError( e );
255-
}
256-
closelock.lock();
257-
selector = null;
258-
closelock.unlock();
259-
try {
260-
channel.close();
261-
} catch ( IOException e ) {
262-
onError( e );
263-
}
264-
channel = null;
265265
}
266266

267267
private int getPort() {

0 commit comments

Comments
 (0)