Rapsssito / react-native-tcp-socket

React Native TCP socket API for Android, iOS & macOS with SSL/TLS support.
MIT License
303 stars 81 forks source link

fix: crash on write if socket is null #154

Closed cc-steina closed 1 year ago

cc-steina commented 2 years ago

Sends write exection only if socket is not null. This crashed the app I'm currently working on as described in this Ticket: #153

Rapsssito commented 2 years ago

@cc-steina, thanks for the PR! However, this does not fix the root cause of the issue. Can you when the socket is being set to null after the server disconnection?

cc-steina commented 2 years ago

The Server does not send anything and the client doesent notice that the socket is broken. The Event on close is not being called when the server is just being disconnected from the wifi.

We currently have two phones talking to one another and if the server is just being disconnected from the internet the client doesent seem to notice until it is too late. No close or error event is being emitted allowing the java code to try to use a socket that is actually NULL at that point.

Rapsssito commented 1 year ago

This fix has been implemented in 59d3195a8c68eddb0341c8264d712ed2266d23b5