StreamingSocket crashes when remote socket closed

I have a StreamingSocket. If the remote socket closes without warning, the next time I do a send it crashes:

libsystem_kernel.dylib`__sendto:

    0x7fff95f2a4e0 <+0>:  movl   $0x2000085, %eax

    0x7fff95f2a4e5 <+5>:  movq   %rcx, %r10

    0x7fff95f2a4e8 <+8>:  syscall 

->  0x7fff95f2a4ea <+10>: jae    0x7fff95f2a4f4            ; <+20>

    0x7fff95f2a4ec <+12>: movq   %rax, %rdi

    0x7fff95f2a4ef <+15>: jmp    0x7fff95f25c78            ; cerror

    0x7fff95f2a4f4 <+20>: retq   

    0x7fff95f2a4f5 <+21>: nop    

    0x7fff95f2a4f6 <+22>: nop    

    0x7fff95f2a4f7 <+23>: nop    

Callstack:


Juce Message Thread (1)Queue : com.apple.main-thread (serial)
#0    0x00007fff95f2a4ea in __sendto ()
#1    0x000000010a7309e4 in juce::StreamingSocket::write(void const*, int) at /Users/rrabien/JUCE-OSX/modules/juce_core/network/juce_Socket.cpp:428

Juce disables sig_pipe, so I'm not sure why writing to a closed socket is an issue. Shouldn't it just return an error?

Is it really a crash, or just a sigpipe? We've been doing a bunch of socket stuff lately with child processes dying and I've not seen an actual crash, (though the sigpipe signals in the debugger can be annoying)

Hmm, I'm not really sure. I don't know much about signals.

I tried adding signal(SIGPIPE, SIG_IGN); to ignore all the signals, but it's still happening. Maybe another library I'm using is re-enabling them. I'll look into that.

Yes, it was just XCode stopping on the signal. To ignore it:

process handle SIGPIPE -n true -p true -s false