mirror of
https://github.com/corda/corda.git
synced 2025-01-19 11:16:54 +00:00
handle and ignore SIGPIPE on Posix systems
We must handle this signal or we'll get the default behavior of exiting the process whenever we get an unexpected network disconnection.
This commit is contained in:
parent
b3accf1b30
commit
081d2d68ce
@ -65,13 +65,16 @@ const int AltSegFaultSignal = SIGBUS;
|
||||
const int AltSegFaultSignal = InvalidSignal;
|
||||
#endif
|
||||
const unsigned AltSegFaultSignalIndex = 3;
|
||||
const int PipeSignal = SIGPIPE;
|
||||
const unsigned PipeSignalIndex = 4;
|
||||
|
||||
const int signals[] = { VisitSignal,
|
||||
SegFaultSignal,
|
||||
InterruptSignal,
|
||||
AltSegFaultSignal };
|
||||
AltSegFaultSignal,
|
||||
PipeSignal };
|
||||
|
||||
const unsigned SignalCount = 4;
|
||||
const unsigned SignalCount = 5;
|
||||
|
||||
class MySystem;
|
||||
MySystem* system;
|
||||
@ -530,6 +533,7 @@ class MySystem: public System {
|
||||
system = this;
|
||||
|
||||
registerHandler(&nullHandler, InterruptSignalIndex);
|
||||
registerHandler(&nullHandler, PipeSignalIndex);
|
||||
registerHandler(&nullHandler, VisitSignalIndex);
|
||||
|
||||
expect(this, make(&visitLock) == 0);
|
||||
@ -786,6 +790,7 @@ class MySystem: public System {
|
||||
|
||||
registerHandler(0, InterruptSignalIndex);
|
||||
registerHandler(0, VisitSignalIndex);
|
||||
registerHandler(0, PipeSignalIndex);
|
||||
system = 0;
|
||||
|
||||
::free(this);
|
||||
@ -862,6 +867,10 @@ handleSignal(int signal, siginfo_t* info, void* context)
|
||||
index = InterruptSignalIndex;
|
||||
} break;
|
||||
|
||||
case PipeSignal: {
|
||||
index = PipeSignalIndex;
|
||||
} break;
|
||||
|
||||
default: abort();
|
||||
}
|
||||
|
||||
@ -873,6 +882,7 @@ handleSignal(int signal, siginfo_t* info, void* context)
|
||||
switch (signal) {
|
||||
case VisitSignal:
|
||||
case InterruptSignal:
|
||||
case PipeSignal:
|
||||
break;
|
||||
|
||||
default:
|
||||
|
Loading…
Reference in New Issue
Block a user