summaryrefslogtreecommitdiff
path: root/source4/smbd/service_task.c
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2009-09-18 18:05:55 -0700
committerAndrew Tridgell <tridge@samba.org>2009-09-18 18:05:55 -0700
commite9a589feac531379e569bc39d803b16179002cfa (patch)
tree81fcaf840fa0ed4513e4d17d6e20f47434ca5ac5 /source4/smbd/service_task.c
parentade5d43c5ceb915dd2210a735a21fd9bed531dd3 (diff)
downloadsamba-e9a589feac531379e569bc39d803b16179002cfa.tar.gz
samba-e9a589feac531379e569bc39d803b16179002cfa.tar.bz2
samba-e9a589feac531379e569bc39d803b16179002cfa.zip
s4-server: kill main daemon if a task fails to initialise
When one of our core tasks fails to initialise it can now ask for the server as a whole to die, rather than limping along in a degraded state.
Diffstat (limited to 'source4/smbd/service_task.c')
-rw-r--r--source4/smbd/service_task.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/source4/smbd/service_task.c b/source4/smbd/service_task.c
index c4fd3d4e98..5db8995764 100644
--- a/source4/smbd/service_task.c
+++ b/source4/smbd/service_task.c
@@ -25,15 +25,29 @@
#include "smbd/service_task.h"
#include "lib/messaging/irpc.h"
#include "param/param.h"
+#include "librpc/gen_ndr/ndr_irpc.h"
/*
terminate a task service
*/
-void task_server_terminate(struct task_server *task, const char *reason)
+void task_server_terminate(struct task_server *task, const char *reason, bool fatal)
{
struct tevent_context *event_ctx = task->event_ctx;
const struct model_ops *model_ops = task->model_ops;
DEBUG(0,("task_server_terminate: [%s]\n", reason));
+
+ if (fatal) {
+ struct samba_terminate r;
+ struct server_id *sid;
+
+ sid = irpc_servers_byname(task->msg_ctx, task, "samba");
+
+ r.in.reason = reason;
+ IRPC_CALL(task->msg_ctx, sid[0],
+ irpc, SAMBA_TERMINATE,
+ &r, NULL);
+ }
+
model_ops->terminate(event_ctx, task->lp_ctx, reason);
/* don't free this above, it might contain the 'reason' being printed */
@@ -72,7 +86,7 @@ static void task_server_callback(struct tevent_context *event_ctx,
lp_iconv_convenience(task->lp_ctx),
task->event_ctx);
if (!task->msg_ctx) {
- task_server_terminate(task, "messaging_init() failed");
+ task_server_terminate(task, "messaging_init() failed", true);
return;
}