C++ OpenSSL SSL_关闭收到信号信号信号管道,管道破裂

C++ OpenSSL SSL_关闭收到信号信号信号管道,管道破裂,c++,c,ssl,libevent,C++,C,Ssl,Libevent,我正在使用openssl-0.9.8e编写http/https客户端 调用SSL\u read() 然后,我调用SSL\u get\u errorgetSSL\u error\u SYSCALL和errnoeconreset 104/*由对等方重置连接*/ 根据SSL文档,这就是它的含义: SSL_ERROR_SYSCALL Some I/O error occurred. The OpenSSL error queue may contain more information on th

我正在使用openssl-0.9.8e编写http/https客户端

调用
SSL\u read()

然后,我调用
SSL\u get\u error
get
SSL\u error\u SYSCALL
和errno
econreset 104/*由对等方重置连接*/

根据SSL文档,这就是它的含义:

 SSL_ERROR_SYSCALL

 Some I/O error occurred. The OpenSSL error queue may contain more information on the error. 
If the error queue is empty (i.e. ERR_get_error() returns 0), ret can be used to find out more about the
    error: If ret == 0, an EOF was observed that violates the protocol. If ret == -1, the underlying BIO
    reported an I/O error (for socket I/O on Unix systems, consult errno for details).
嗯,连接重置,我调用
SSL\u shutdown
来关闭连接,哦,
程序收到信号SIGPIPE,管道破裂。

上帝,我呼唤信号(信号管,信号灯)忽略“SIGPIPE”信号,但它似乎不起作用~

出现分段错误

#0  0x00000032bd00d96b in write () from /lib64/libpthread.so.0
#1  0x0000003add478367 in ?? () from /lib64/libcrypto.so.6
#2  0x0000003add4766fe in BIO_write () from /lib64/libcrypto.so.6
#3  0x0000003add8208fd in ssl3_write_pending () from /lib64/libssl.so.6
#4  0x0000003add820d9a in ssl3_dispatch_alert () from /lib64/libssl.so.6
#5  0x0000003add81e982 in ssl3_shutdown () from /lib64/libssl.so.6
#6  0x00000000004565d0 in CWsPollUrl::SSLClear (this=<value optimized out>, ctx=0x2aaab804a1b0, ssl=0x2aaab804a680)
    at ../src/Wspoll.cpp:1122
#7  0x00000000004575e0 in CWsPollUrl::asyncEventDelete (this=0x4d422e50, eev=0x2aaab8001160) at ../src/Wspoll.cpp:1546
#8  0x000000000045928a in CWsPollUrl::onFail (this=0x4d422e50, eev=0x2aaab8001160, errorCode=4) at ../src/Wspoll.cpp:1523
#9  0x000000000045ab17 in CWsPollUrl::handleData (this=0x4d422e50, eev=0x2aaab8001160, len=<value optimized out>) at ../src/Wspoll.cpp:1259
#10 0x000000000045abcc in CWsPollUrl::asyncRecvEvent (this=0x4d422e50, fd=<value optimized out>, eev=0x2aaab8001160)
    at ../src/Wspoll.cpp:1211
#11 0x00000000004636b5 in event_base_loop (base=0x14768360, flags=0) at event.c:1350
#12 0x0000000000456a62 in CWsPollUrl::run (this=<value optimized out>, param=<value optimized out>) at ../src/Wspoll.cpp:461
#13 0x0000000000436c5c in doPollUrl (data=<value optimized out>, user_data=<value optimized out>) at ../src/PollStrategy.cpp:151
#14 0x00000032bf44a95d in ?? () from /lib64/libglib-2.0.so.0
#15 0x00000032bf448e04 in ?? () from /lib64/libglib-2.0.so.0
#16 0x00000032bd00677d in start_thread () from /lib64/libpthread.so.0
#17 0x00000032bc4d3c1d in clone () from /lib64/libc.so.6
#0 0x00000032bd00d96b在/lib64/libpthread.so.0中写入()
#1 0x0000003add478367英寸??()来自/lib64/libcrypto.so.6
#来自/lib64/libcrypto.so.6的BIO_write()中的2 0x0000003add4766fe
#来自/lib64/libssl.so.6的ssl3_write_pending()中的3 0x0000003AD8208FD
#来自/lib64/libssl.so.6的ssl3_调度_警报()中的4 0x0000003AD820D9A
#来自/lib64/libssl.so.6的ssl3_shutdown()中的5 0x0000003add81e982
#CWsPollUrl::SSLClear中的6 0x00000000004565d0(this=,ctx=0x2aab804a1b0,ssl=0x2aab804a680)
地址../src/Wspoll.cpp:1122
#位于../src/Wspoll.cpp:1546的CWsPollUrl::asyncEventDelete(this=0x4d422e50,eev=0x2AAB8001160)中的7 0x00000000004575e0
#位于../src/Wspoll.cpp:1523的CWsPollUrl::onFail中的8 0x000000000045928a(此参数=0x4d422e50,eev=0x2AAB8001160,错误代码=4)
#9位于../src/Wspoll.cpp:1259的CWsPollUrl::handleData中的0x000000000045ab17(this=0x4d422e50,eev=0x2AAB8001160,len=)
#CWsPollUrl::AsyncRecveEvent中的10 0x000000000045abcc(this=0x4d422e50,fd=,eev=0x2AAB8001160)
在../src/Wspoll.cpp:1211
#11 0x00000000004636b5在事件c:1350处的事件基础循环(基础=0x14768360,标志=0)中
#CWsPollUrl::run(this=,param=)中的12 0x0000000000456a62位于../src/Wspoll.cpp:461
#位于../src/PollStrategy.cpp:151的doPollUrl(数据=,用户数据=)中的13 0x0000000000436c5c
#14 0x00000032bf44a95d英寸??()来自/lib64/libglib-2.0.so.0
#15 0x00000032bf448e04英寸??()来自/lib64/libglib-2.0.so.0
#在/lib64/libpthread.so.0的start_thread()中的16 0x00000032bd00677d
#/lib64/libc.so.6中的克隆()中的17 0x00000032bc4d3c1d
为什么我得到SIGPIPE信号,我已经调用了
信号(SIGPIPE,SIG_IGN)
有人知道为什么吗


提前感谢

如果SSL_read出现I/O错误,那么调用SSL_shutdown没有多大意义,因为shutdown尝试向对等方发送“close notify”shutdown警报,这显然不会在断开的连接上起作用。因此,你得到了信号管或EPIPE。在本例中,从SSL_读取获取EconReset可能意味着客户端已硬关闭连接,例如,未关闭SSL_。错误发生后,您不应继续使用套接字,例如,甚至不关闭SSL。\p>如果在读取时出现错误而不是超时,则几乎可以肯定您正在处理已断开的连接。可能会出现的任何后续错误都应该被忽略。是否确实调用了
信号(SIGPIPE,SIG_IGN)在这个过程中?如果在fork和exec之前调用它,它可能会被重置。此外,正确关闭被对等方中断的连接似乎是无用的。