Closed babrauskas closed 6 years ago
Merging #27 into master-rest will increase coverage by
9.6%
. The diff coverage is68.42%
.
@@ Coverage Diff @@
## master-rest #27 +/- ##
==============================================
+ Coverage 62.34% 71.94% +9.6%
==============================================
Files 9 9
Lines 725 802 +77
==============================================
+ Hits 452 577 +125
+ Misses 273 225 -48
Impacted Files | Coverage Δ | |
---|---|---|
examples/rest-server/restserver.c | 73.85% <68.42%> (-0.51%) |
:arrow_down: |
examples/rest-server/rest-core.c | 59.61% <0%> (-3.8%) |
:arrow_down: |
examples/rest-server/rest-resources.c | 71.55% <0%> (+20.18%) |
:arrow_up: |
examples/rest-server/rest-subscriptions.c | 82.11% <0%> (+39.14%) |
:arrow_up: |
Continue to review full report at Codecov.
Legend - Click here to learn more
Δ = absolute <relative> (impact)
,ø = not affected
,? = missing data
Powered by Codecov. Last update ecbbe8e...5fab9f9. Read the comment docs.
From example demo_https.c server. Server can often crash without pipe signal ignore registration. https://stackoverflow.com/questions/108183/how-to-prevent-sigpipes-or-handle-them-properly
Additional info from microhttp docs: section SIGPIPE cindex signals MHD does not install a signal handler for SIGPIPE. On platforms where this is possible (such as GNU/Linux), it disables SIGPIPE for its I/O operations (by passing MSG_NOSIGNAL). On other platforms, SIGPIPE signals may be generated from network operations by MHD and will cause the process to die unless the developer explicitly installs a signal handler for SIGPIPE.
Hence portable code using MHD must install a SIGPIPE handler or explicitly block the SIGPIPE signal. MHD does not do so in order to avoid messing with other parts of the application that may need to handle SIGPIPE in a particular way. You can make your application handle SIGPIPE by calling the following function in main():
static void catcher (int sig) { }
static void ignore_sigpipe () { struct sigaction oldsig; struct sigaction sig;
sig.sa_handler = &catcher; sigemptyset (&sig.sa_mask);
ifdef SA_INTERRUPT
sig.sa_flags = SA_INTERRUPT; / SunOS /
else
sig.sa_flags = SA_RESTART;
endif
if (0 != sigaction (SIGPIPE, &sig, &oldsig)) fprintf (stderr, "Failed to install SIGPIPE handler: %s\n", strerror (errno)); }