SSL 握手错误:会话 ID 上下文未初始化

SSL 握手错误:会话 ID 上下文未初始化

问题描述:

我正在编写使用 boost::asiolibssl 的服务器应用程序,它与 boost::asio 集成.当有传入连接时,第一次握手成功,但在连接断开并客户端再次尝试连接后,握手失败并显示错误:

I'm writing server application which uses boost::asio, and libssl via its integration with boost::asio. When there is incoming connection, the first time the handshake succeeded, but after the connection is dropped and the client tries to connect again, the handshake fails with the error:

会话 ID 上下文未初始化

session id context uninitialized

这里 提出了在初始化 SSL 上下文时使用 SSL_OP_NO_TICKET 选项的解决方案.我使用它的方式如下:

Here has proposed solution with using SSL_OP_NO_TICKET option when the SSL context is initialized. I'm using it the following way:

m_sslContext.set_options(SSL_OP_NO_TICKET);

一开始这解决了问题,但现在尽管仍然设置了该选项,但错误再次出现.有没有人知道其他可以解决这个问题的方法?

In the beginning this resolves the problem, but now despite the option is still set the error appears again. Does anybody has an idea what other can be done with this problem?

我发现当问题出现时,我仍然有一个到同一个远程端点的旧连接,它尝试再次连接.当我正确断开旧连接时,问题就消失了.

I found that when the problem arises I still have an old connection to the same remote endpoint which tries to connect again. When I dropped the old connection properly the problem gone.