This happens because here we safeguard against multiple server instances launched in the app, but the only place we reset server variable, here, is reacheable only when no errors happen. If server exits with an error, it is not reset to null. To fix, need correctly reset it to null in case of failures inside the server signals handler.
This happens because here we safeguard against multiple server instances launched in the app, but the only place we reset
server
variable, here, is reacheable only when no errors happen. If server exits with an error, it is not reset tonull
. To fix, need correctly reset it tonull
in case of failures inside the server signals handler.https://github.com/birdofpreyru/react-native-static-server/blob/a95b656bfd89b9ba8f83dec85429b2a147a8d52c/android/src/main/java/com/drpogodin/reactnativestaticserver/ReactNativeStaticServerModule.java#L107-L117