利用boost+Openssl支持一些安全协议链接时,要特别注意多线程的安全性。
官方文档明确指出了boost::asio::ssl::stream不是线程安全的需要保证其同一个对象不可多线程同时调用
Thread Safety
Distinct objects: Safe.
Shared objects: Unsafe. The application must also ensure that all asynchronous operations are performed within the same implicit or explicit strand.
Openssl在1.1.0版本后,就支持编译默认开启多线程支持,不过目前还是有遇到问题正在解决,在压力测试的时候会出现ssl中反馈异常崩溃的问题。