Given a scenario where:
SSL_read()
(and a large enough buffer to hold them). Will SSL_shutdown()
discard any remaining SSL read data on the socket for which I haven't called SSL_read()
read yet, or do I always need to just keep on calling SSL_read()
first until it yields SSL_ERROR_WANT_READ
(which would waste CPU cycles extracting data I don't even care about anymore) and then call SSL_shutdown()
?
What concerns me is that SSL_shutdown()
too can yield SSL_ERROR_WANT_READ
(according to the man page at least), but if for whatever reason there is still unread data on the socket, I won't necessarily be notified of new incoming packets because of how I use epoll_wait()
.
Checked the ssl_shutdown code of openssl as well as documentation.. There is no mention of the cleanup done as part of the shutdown. It appears to send just the Close notification to the peer and set state to appropriate state.
I feel the cleanup u are looking for will be done when SSL_free(ssl) will be called. (just my thought as haven't checked the free code deeply).
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.