alwx / react-native-http-bridge

HTTP server for React Native
122 stars 79 forks source link

Synchronizes responses Map on Android #16

Open klehmann opened 5 years ago

klehmann commented 5 years ago

In the Server class (https://github.com/alwx/react-native-http-bridge/blob/master/android/src/main/java/me/alwx/HttpServer/Server.java#L30) you are using a HashMap to store the pending requests. Since HashMap is not Thread-safe, this class needs to be synchronized, e.g. by wrapping it in Collections.synchronizedMap(...), to avoid multi threading effects.