Add MSG_NOSIGNAL to AsyncSSLSocket
authorSubodh Iyengar <subodh@fb.com>
Tue, 9 Aug 2016 00:55:10 +0000 (17:55 -0700)
committerFacebook Github Bot 2 <facebook-github-bot-2-bot@fb.com>
Tue, 9 Aug 2016 01:08:36 +0000 (18:08 -0700)
Summary:
We are definitely not prepared to handle
SIGPIPEs, so add MSG_NOSIGNAL to sendmsg
of AsyncSSLSocket.

This is a problem which exists in openssl
as well which calls send with flags = 0.
We recently made a change to move the send
into our control, so we can now supply the
flag

Reviewed By: yfeldblum

Differential Revision: D3686679

fbshipit-source-id: ff8fe662e62923c25876bdfd516352639505dca6

folly/io/async/AsyncSSLSocket.cpp

index a326ca5c1f6e0145060c55f64485ceb6f458a131..b398e31c8bc85aeb618fdf979c88d4463250b668 100644 (file)
@@ -1536,6 +1536,10 @@ int AsyncSSLSocket::bioWrite(BIO* b, const char* in, int inl) {
     flags = MSG_EOR;
   }
 
+#ifdef MSG_NOSIGNAL
+  flags |= MSG_NOSIGNAL;
+#endif
+
   auto result =
       tsslSock->sendSocketMessage(BIO_get_fd(b, nullptr), &msg, flags);
   BIO_clear_retry_flags(b);