简体   繁体   English

关于SSL_do_handshake bloocking调用

[英]regarding SSL_do_handshake bloocking call

I am calling SSL_do_handshake with underlying BIO as blocking, means it will wait till handshake is done or error occured. 我正在调用SSL_do_handshake,并将底层BIO作为阻止,这意味着它将等待握手完成或发生错误。 Is there any way so that i can cancel this waiting call (waiting on SSL_do_handshake) from some other thread. 有什么办法可以取消其他线程的等待调用(在SSL_do_handshake上等待)。 i used SSL_clear,SSL_shutdown,SSL_free methods but thread is still waiting on SSL_do_handshake function call. 我使用了SSL_clear,SSL_shutdown,SSL_free方法,但是线程仍在等待SSL_do_handshake函数调用。 Please help. 请帮忙。

This is not nice way, but it should work: 这不是一个好方法,但是它应该可以工作:

Close the underlying TCP socket by using close() . 通过使用close()关闭基础的TCP套接字。

Any blocking IO with the socket will fail, and SSL_do_handshake() returns error. 任何使用套接字的阻塞IO都会失败,并且SSL_do_handshake()返回错误。

But be carefully when closing sockets from other thread, because file descriptor numbers can be reused. 但是从其他线程关闭套接字时要小心,因为文件描述符号可以重复使用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM