thaliproject / Thali_CordovaPlugin

Thali p2p plugin
MIT License
226 stars 44 forks source link

ThaliCore: two dead-locks in AdvertiserRelay #1926

Closed enricogior closed 6 years ago

enricogior commented 7 years ago

This line: https://github.com/thaliproject/thali-ios/blob/5c5a475a5afa258e6aa098edb581ff97724ff221/ThaliCore/SocketConnection/AdvertiserRelay.swift#L46 can cause a dead-lock if the else condition is executed. I didn't spend time to investigate if it's a Swift bug or a code bug, but there is a simple way to avoid the problem in the first place.

This line can also cause a dead-lock if an error occurs while reading form the stream: https://github.com/thaliproject/thali-ios/blob/5c5a475a5afa258e6aa098edb581ff97724ff221/ThaliCore/SocketConnection/AdvertiserRelay.swift#L114 The fix is trivial.

enricogior commented 6 years ago

Fixed in https://github.com/thaliproject/thali-ios/commits/master-enrico-error-handling-tmp