1

Topic: getting sigpipe from wolfSSL_write

hello

i have a c++ app that connects to another machine and (rarely) gets sigpipe, which is bad since i want the app to keep running and try again later
the stacktrace looks like this:
wolfSSL_write ->
SendData ->
SendBuffered.part.0 ->
EmbedSend ->
"../sysdeps/unix/sysv/linux/send.c", line 23, in __libc_send ->
"../sysdeps/unix/sysv/linux/send.c", line 28, in __libc_disable_asynccancel

i assume that the other machine disconnects between the app checking the validity of the connection and wolfSSL_write
obviously, i can make a signal handler that throws an exception on sigpipe and then catches the exception outside wolfSSL_write
but i am curious whether i can make a signal handler that ignores the sigpipe, and then just continue with the wolfSSL_write
i assume wolfSSL_write should return -1, and then i would get the exact error with wolfSSL_get_error

my questions are
1. did i understand correctly that on sigpipe while writing, although sigpipe is raised, wolfssl will return -1?
2. what is the error i would receive from wolfSSL_get_error in this case?

thank you

Share

Re: getting sigpipe from wolfSSL_write

Hi db,

My name is Anthony and I am a member of the wolfSSL team. From what I understand, sigpipe means  the peer closed the socket when there was data still available to read.  This is generally resolved by, on both sides, doing a shutdown (for example, calling wolfSSL_shutdown() ) , checking for WOLFSSL_SHUTDOWN_NOT_DONE, and then doing wolfSSL_shutdown() again.  You can search for WOLFSSL_SHUTDOWN_NOT_DONE in wolfssl/examples/server/server.c and wolfssl/examples/client/client.c to see what I mean.

Warm regards, Anthony

Share