File tree Expand file tree Collapse file tree 2 files changed +9
-4
lines changed
src/main/java/com/google/firebase/database/connection Expand file tree Collapse file tree 2 files changed +9
-4
lines changed Original file line number Diff line number Diff line change 3333import io .netty .handler .ssl .SslContext ;
3434import io .netty .handler .ssl .SslContextBuilder ;
3535
36+ import java .io .EOFException ;
3637import java .net .URI ;
3738import java .security .KeyStore ;
3839import java .util .concurrent .ExecutorService ;
@@ -130,8 +131,12 @@ public void close() {
130131
131132 @ Override
132133 public void send (String msg ) {
133- checkState (channel != null && channel .isActive (), "channel not connected for sending" );
134- channel .writeAndFlush (new TextWebSocketFrame (msg ));
134+ checkState (channel != null , "Channel not initialized" );
135+ if (!channel .isActive ()) {
136+ eventHandler .onError (new EOFException ("WebSocket channel became inactive" ));
137+ } else {
138+ channel .writeAndFlush (new TextWebSocketFrame (msg ));
139+ }
135140 }
136141
137142 /**
Original file line number Diff line number Diff line change @@ -324,8 +324,8 @@ public void run() {
324324
325325 @ Override
326326 public void onError (final Throwable e ) {
327- if (e . getCause () != null && e .getCause () instanceof EOFException ) {
328- logger .error ("WebSocket reached EOF" , e );
327+ if (e instanceof EOFException || e .getCause () instanceof EOFException ) {
328+ logger .debug ("WebSocket reached EOF" , e );
329329 } else {
330330 logger .error ("WebSocket error" , e );
331331 }
You can’t perform that action at this time.
0 commit comments