oxen-io / oxen-mq

Communications layer used for both the Oxen storage server and oxend
https://oxen.io
BSD 3-Clause "New" or "Revised" License
19 stars 37 forks source link

Fix segfault on shutdown: Move socket holding into LokiMQ instance #25

Closed jagerman closed 3 years ago

jagerman commented 3 years ago

The thread_local std::map here can end up being destructed before the LokiMQ instance (if both are being destroyed during thread joining), in which case we segfault by trying to use the map. Move the owning container into the LokiMQ instead (indexed by the thread) to prevent that.

Also cleans this code up by:

Fixes #24