Skip to content

Commit 16242e9

Browse files
author
Don Park
committed
start the websocket if the socket open worked
1 parent 9418783 commit 16242e9

1 file changed

Lines changed: 2 additions & 4 deletions

File tree

‎src/net/tootallnate/websocket/WebSocketClient.java‎

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,6 @@ private void tryToConnect( InetSocketAddress remote ) throws IOException {
127127
client.connect( remote );
128128
selector = Selector.open();
129129
client.register( selector, SelectionKey.OP_CONNECT );
130-
conn = new WebSocket( this, draft, client );
131130
}
132131

133132
// Runnable IMPLEMENTATION /////////////////////////////////////////////////
@@ -147,18 +146,17 @@ protected void interruptableRun() {
147146
return;
148147
}catch ( IOException e ) {//
149148
onError( conn, e );
150-
conn.close();
151149
return;
152150
} catch ( SecurityException e ) {
153151
onError( conn, e );
154-
conn.close();
155152
return;
156153
} catch ( UnresolvedAddressException e ) {
157154
onError( conn, e );
158-
conn.close();
159155
return;
160156
}
161157

158+
conn = new WebSocket( this, draft, client );
159+
162160
while ( !Thread.interrupted() ) {
163161
SelectionKey key = null;
164162
try {

0 commit comments

Comments
 (0)