s4-rpcserver: run all RPC operations in a single task
authorAndrew Tridgell <tridge@samba.org>
Tue, 22 Sep 2009 02:57:27 +0000 (19:57 -0700)
committerAndrew Tridgell <tridge@samba.org>
Wed, 23 Sep 2009 00:10:05 +0000 (17:10 -0700)
This will make it much easier to implement shared handles with
association groups. It also means we can shared the ldb between RPC
connections.

source4/rpc_server/service_rpc.c

index 64c6728322882a3fee2de773afff106009b11d74..ea416894d00cec8d55f08928e76555443f318a95 100644 (file)
@@ -39,6 +39,7 @@
 #include "../lib/util/tevent_ntstatus.h"
 #include "libcli/raw/smb.h"
 #include "../libcli/named_pipe_auth/npa_tstream.h"
+#include "smbd/process_model.h"
 
 struct dcesrv_socket_context {
        const struct dcesrv_endpoint *endpoint;
@@ -685,11 +686,17 @@ static void dcesrv_task_init(struct task_server *task)
        NTSTATUS status;
        struct dcesrv_context *dce_ctx;
        struct dcesrv_endpoint *e;
+       const struct model_ops *model_ops;
 
        dcerpc_server_init(task->lp_ctx);
 
        task_server_set_title(task, "task[dcesrv]");
 
+       /* run the rpc server as a single process to allow for shard
+        * handles, and sharing of ldb contexts */
+       model_ops = process_model_startup(task->event_ctx, "single");
+       if (!model_ops) goto failed;
+
        status = dcesrv_init_context(task->event_ctx,
                                     task->lp_ctx,
                                     lp_dcerpc_endpoint_servers(task->lp_ctx),
@@ -702,7 +709,7 @@ static void dcesrv_task_init(struct task_server *task)
        }
 
        for (e=dce_ctx->endpoint_list;e;e=e->next) {
-               status = dcesrv_add_ep(dce_ctx, task->lp_ctx, e, task->event_ctx, task->model_ops);
+               status = dcesrv_add_ep(dce_ctx, task->lp_ctx, e, task->event_ctx, model_ops);
                if (!NT_STATUS_IS_OK(status)) goto failed;
        }