[英]OpenSSL SSL_read() returns 0 and SSL_get_error() returns 6, what can I do to fix this?
I'm receiving data via an SSL connection and after several minutes SSL_read()
returns 0 (I'm using blocking socket, so it shouldn't return 0) and then SSL_get_error()
returns 6. However, I cannot find what 6 means and what I need to do to fix this?我通过 SSL 连接接收数据,几分钟后
SSL_read()
返回 0(我使用的是阻塞套接字,因此它不应该返回 0)然后SSL_get_error()
返回 6。但是,我找不到 6 的含义我需要做什么来解决这个问题?
It's happening multiple times, each time it occurs several minutes after I establish connection.它发生了多次,每次都是在我建立连接后几分钟发生的。
As i'm only streaming data there's not much I can be doing wrong.因为我只是在传输数据,所以我不会做错太多。
Any advice how to log additional information on SSL problems?任何建议如何记录有关 SSL 问题的附加信息?
However, I cannot find what 6 means
但是,我找不到 6 是什么意思
The relevant define's are in ssl.h:相关定义在 ssl.h 中:
$ grep SSL_ERROR_ /usr/include/openssl/ssl.h
# define SSL_ERROR_NONE 0
...
# define SSL_ERROR_ZERO_RETURN 6
...
From the documentation on this error :从 有关此错误的文档中:
SSL_ERROR_ZERO_RETURN
SSL_ERROR_ZERO_RETURN
The TLS/SSL peer has closed the connection for writing by sending the close_notify alert.TLS/SSL 对等端已通过发送 close_notify 警报关闭写入连接。 No more data can be read.
无法读取更多数据。 Note that SSL_ERROR_ZERO_RETURN does not necessarily indicate that the underlying transport has been closed.
请注意,SSL_ERROR_ZERO_RETURN 不一定表示底层传输已关闭。
In other words: the peer did a shutdown of the TLS session. So this is not actually a SSL problem since the peer behaves how it is supposed when closing the SSL session.换句话说:对等点关闭了 TLS session。因此,这实际上不是 SSL 问题,因为对等点在关闭 SSL session 时的行为是预期的。
what I need to do to fix this?
我需要做什么来解决这个问题?
It is unknown why the peer closes the connection but it unlikely has anything to do with SSL.不知道为什么对等方关闭连接,但它不太可能与 SSL 有任何关系。
Unfortunately there is nothing known about he peer or the application protocol you are using.不幸的是,关于他的对等点或您正在使用的应用程序协议一无所知。 So it is unclear how the peer should behave in the first place, ie if what you see is normal behavior and your expectations are wrong or if there is some problem at the peer.
因此,首先不清楚对等点应该如何表现,即如果您看到的是正常行为而您的期望是错误的,或者对等点是否存在问题。
So first step for fixing would be to understand what application protocol is used here and if what you see might even be the expected behavior.因此,修复的第一步是了解此处使用的是什么应用程序协议,以及您看到的是否可能是预期的行为。 If this is not the case check any log files on the peer side or analyze the source code of the peer for bugs.
如果不是这种情况,请检查对等方的任何日志文件或分析对等方的源代码以查找错误。
If you expect more help from the community please provide enough context about application protocol and the peer, so that ideally others can reproduce and thus debug what you see.如果您希望从社区获得更多帮助,请提供有关应用程序协议和对等方的足够上下文,以便理想情况下其他人可以重现并调试您所看到的内容。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.