diff options
Diffstat (limited to 'src/daemon/daemon.c')
-rw-r--r-- | src/daemon/daemon.c | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/src/daemon/daemon.c b/src/daemon/daemon.c index 35eeccce..2dd7551f 100644 --- a/src/daemon/daemon.c +++ b/src/daemon/daemon.c | |||
@@ -354,6 +354,11 @@ MHD_cleanup_connections (struct MHD_Daemon *daemon) | |||
354 | #endif | 354 | #endif |
355 | CLOSE (pos->socket_fd); | 355 | CLOSE (pos->socket_fd); |
356 | pos->socket_fd = -1; | 356 | pos->socket_fd = -1; |
357 | if (pos->daemon->notify_completed != NULL) | ||
358 | pos->daemon->notify_completed(pos->daemon->notify_completed_cls, | ||
359 | pos, | ||
360 | &pos->client_context, | ||
361 | MHD_REQUEST_TERMINATED_TIMEOUT_REACHED); | ||
357 | } | 362 | } |
358 | if (pos->socket_fd == -1) | 363 | if (pos->socket_fd == -1) |
359 | { | 364 | { |
@@ -680,6 +685,10 @@ MHD_start_daemon (unsigned int options, | |||
680 | case MHD_OPTION_CONNECTION_TIMEOUT: | 685 | case MHD_OPTION_CONNECTION_TIMEOUT: |
681 | retVal->connection_timeout = va_arg (ap, unsigned int); | 686 | retVal->connection_timeout = va_arg (ap, unsigned int); |
682 | break; | 687 | break; |
688 | case MHD_OPTION_NOTIFY_COMPLETED: | ||
689 | retVal->notify_completed = va_arg(ap, MHD_RequestCompletedCallback); | ||
690 | retVal->notify_completed_cls = va_arg(ap, void *); | ||
691 | break; | ||
683 | default: | 692 | default: |
684 | fprintf (stderr, | 693 | fprintf (stderr, |
685 | "Invalid MHD_OPTION argument! (Did you terminate the list with MHD_OPTION_END?)\n"); | 694 | "Invalid MHD_OPTION argument! (Did you terminate the list with MHD_OPTION_END?)\n"); |
@@ -733,7 +742,12 @@ MHD_stop_daemon (struct MHD_Daemon *daemon) | |||
733 | MHD_DLOG (daemon, | 742 | MHD_DLOG (daemon, |
734 | "MHD shutdown, closing active connections\n"); | 743 | "MHD shutdown, closing active connections\n"); |
735 | #endif | 744 | #endif |
736 | CLOSE (daemon->connections->socket_fd); | 745 | if (daemon->notify_completed != NULL) |
746 | daemon->notify_completed(daemon->notify_completed_cls, | ||
747 | daemon->connections, | ||
748 | &daemon->connections->client_context, | ||
749 | MHD_REQUEST_TERMINATED_DAEMON_SHUTDOWN); | ||
750 | CLOSE (daemon->connections->socket_fd); | ||
737 | daemon->connections->socket_fd = -1; | 751 | daemon->connections->socket_fd = -1; |
738 | } | 752 | } |
739 | MHD_cleanup_connections (daemon); | 753 | MHD_cleanup_connections (daemon); |