File tree Expand file tree Collapse file tree 1 file changed +10
-2
lines changed
src/main/java/org/java_websocket/client Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -343,10 +343,12 @@ private void reset() {
343343 closeBlocking ();
344344 if (writeThread != null ) {
345345 this .writeThread .interrupt ();
346+ this .writeThread .join ();
346347 this .writeThread = null ;
347348 }
348349 if (connectReadThread != null ) {
349350 this .connectReadThread .interrupt ();
351+ this .connectReadThread .join ();
350352 this .connectReadThread = null ;
351353 }
352354 this .draft .reset ();
@@ -505,6 +507,14 @@ public void run() {
505507 throw e ;
506508 }
507509
510+ if (writeThread != null ) {
511+ writeThread .interrupt ();
512+ try {
513+ writeThread .join ();
514+ } catch (InterruptedException e ) {
515+ /* ignore */
516+ }
517+ }
508518 writeThread = new Thread (new WebsocketWriteThread (this ));
509519 writeThread .start ();
510520
@@ -523,7 +533,6 @@ public void run() {
523533 onError (e );
524534 engine .closeConnection (CloseFrame .ABNORMAL_CLOSE , e .getMessage ());
525535 }
526- connectReadThread = null ;
527536 }
528537
529538 private void upgradeSocketToSSL ()
@@ -801,7 +810,6 @@ public void run() {
801810 handleIOException (e );
802811 } finally {
803812 closeSocket ();
804- writeThread = null ;
805813 }
806814 }
807815
You can’t perform that action at this time.
0 commit comments