如何解密boost asio ssl错误代码? [英] How to decipher a boost asio ssl error code?

查看:197
本文介绍了如何解密boost asio ssl错误代码?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个偶尔的通信失败在boost asio ssl实现,boost返回的超级有用的错误消息是'asio.ssl:336458004'

I've got an occasional communications failure in a boost asio ssl implementation, the super helpful error message returned by boost is 'asio.ssl:336458004'

我怀疑该数字是某种由SSL标志组成的聚合构造,我说由于linux错误代码,boost asio错误代码和ssl错误代码没有任何引用'336458004',因此可能它必须是

I suspect that the numerical figure is some sort of aggregate construct composed of SSL flags, I say that because the linux error codes, the boost asio error codes and the ssl error codes do not have any reference to '336458004', so presumably it must be constructed dynamically.

任何人都可以提供一些洞察我如何解密这个错误代码?

Can anyone provide some insight into how I should decipher this error code?, Thanks.

推荐答案

他们使用crypto / err / err.h中的ERR_PACK

they use ERR_PACK from crypto/err/err.h

这将允许将错误转换为字符串

this will allow converting error to string

string err = error.message()
if (error.category() == boost::asio::error::get_ssl_category()) {
    err = string(" (")
            +boost::lexical_cast<string>(ERR_GET_LIB(error.value()))+","
            +boost::lexical_cast<string>(ERR_GET_FUNC(error.value()))+","
            +boost::lexical_cast<string>(ERR_GET_REASON(error.value()))+") "
    ;
    //ERR_PACK /* crypto/err/err.h */
    char buf[128];
    ::ERR_error_string_n(error.value(), buf, sizeof(buf));
    err += buf;
}

可能不包括在boost中,因此asio不需要链接到ssl套接字

Probably not included in boost so asio does not need link to ssl when using pure sockets

这篇关于如何解密boost asio ssl错误代码?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆