mirror of
https://github.com/samba-team/samba.git
synced 2024-12-24 21:34:56 +03:00
s3:misc make use of server_[event/messaging]_context directly
Untangle these functions from smbd specific dependencies so they can be freely used in multiple servers.
This commit is contained in:
parent
cbda0369a8
commit
0962763822
@ -206,7 +206,7 @@ static struct server_security_state *make_server_security_state(struct cli_state
|
||||
interval.tv_sec = lp_keepalive();
|
||||
interval.tv_usec = 0;
|
||||
|
||||
if (event_add_idle(smbd_event_context(), result, interval,
|
||||
if (event_add_idle(server_event_context(), result, interval,
|
||||
"server_security_keepalive",
|
||||
send_server_keepalive,
|
||||
result) == NULL) {
|
||||
|
@ -232,7 +232,7 @@ static void print_notify_event_send_messages(struct tevent_context *event_ctx,
|
||||
TALLOC_FREE(notify_event);
|
||||
|
||||
change_to_root_user();
|
||||
print_notify_send_messages(smbd_messaging_context(), 0);
|
||||
print_notify_send_messages(server_messaging_context(), 0);
|
||||
}
|
||||
|
||||
/**********************************************************************
|
||||
@ -326,9 +326,9 @@ to notify_queue_head\n", msg->type, msg->field, msg->printer));
|
||||
DLIST_ADD_END(notify_queue_head, pnqueue, struct notify_queue *);
|
||||
num_messages++;
|
||||
|
||||
if ((notify_event == NULL) && (smbd_event_context() != NULL)) {
|
||||
if ((notify_event == NULL) && (server_event_context() != NULL)) {
|
||||
/* Add an event for 1 second's time to send this queue. */
|
||||
notify_event = tevent_add_timer(smbd_event_context(), NULL,
|
||||
notify_event = tevent_add_timer(server_event_context(), NULL,
|
||||
timeval_current_ofs(1,0),
|
||||
print_notify_event_send_messages, NULL);
|
||||
}
|
||||
|
@ -434,8 +434,8 @@ static bool cups_pcap_load_async(int *pfd)
|
||||
|
||||
close_all_print_db();
|
||||
|
||||
if (!NT_STATUS_IS_OK(reinit_after_fork(smbd_messaging_context(),
|
||||
smbd_event_context(), true))) {
|
||||
if (!NT_STATUS_IS_OK(reinit_after_fork(server_messaging_context(),
|
||||
server_event_context(), true))) {
|
||||
DEBUG(0,("cups_pcap_load_async: reinit_after_fork() failed\n"));
|
||||
smb_panic("cups_pcap_load_async: reinit_after_fork() failed");
|
||||
}
|
||||
@ -576,7 +576,7 @@ bool cups_cache_reload(void)
|
||||
DEBUG(10,("cups_cache_reload: sync read on fd %d\n",
|
||||
*p_pipe_fd ));
|
||||
|
||||
cups_async_callback(smbd_event_context(),
|
||||
cups_async_callback(server_event_context(),
|
||||
NULL,
|
||||
EVENT_FD_READ,
|
||||
(void *)p_pipe_fd);
|
||||
@ -592,7 +592,7 @@ bool cups_cache_reload(void)
|
||||
*p_pipe_fd ));
|
||||
|
||||
/* Trigger an event when the pipe can be read. */
|
||||
cache_fd_event = event_add_fd(smbd_event_context(),
|
||||
cache_fd_event = event_add_fd(server_event_context(),
|
||||
NULL, *p_pipe_fd,
|
||||
EVENT_FD_READ,
|
||||
cups_async_callback,
|
||||
|
@ -1436,8 +1436,8 @@ void start_background_queue(void)
|
||||
close(pause_pipe[0]);
|
||||
pause_pipe[0] = -1;
|
||||
|
||||
if (!NT_STATUS_IS_OK(reinit_after_fork(smbd_messaging_context(),
|
||||
smbd_event_context(),
|
||||
if (!NT_STATUS_IS_OK(reinit_after_fork(server_messaging_context(),
|
||||
server_event_context(),
|
||||
true))) {
|
||||
DEBUG(0,("reinit_after_fork() failed\n"));
|
||||
smb_panic("reinit_after_fork() failed");
|
||||
@ -1455,10 +1455,11 @@ void start_background_queue(void)
|
||||
exit(1);
|
||||
}
|
||||
|
||||
messaging_register(smbd_messaging_context(), NULL,
|
||||
messaging_register(server_messaging_context(), NULL,
|
||||
MSG_PRINTER_UPDATE, print_queue_receive);
|
||||
|
||||
fde = tevent_add_fd(smbd_event_context(), smbd_event_context(),
|
||||
fde = tevent_add_fd(server_event_context(),
|
||||
server_event_context(),
|
||||
pause_pipe[1], TEVENT_FD_READ,
|
||||
printing_pause_fd_handler,
|
||||
NULL);
|
||||
@ -1468,7 +1469,7 @@ void start_background_queue(void)
|
||||
}
|
||||
|
||||
DEBUG(5,("start_background_queue: background LPQ thread waiting for messages\n"));
|
||||
ret = tevent_loop_wait(smbd_event_context());
|
||||
ret = tevent_loop_wait(server_event_context());
|
||||
/* should not be reached */
|
||||
DEBUG(0,("background_queue: tevent_loop_wait() exited with %d - %s\n",
|
||||
ret, (ret == 0) ? "out of events" : strerror(errno)));
|
||||
@ -1601,7 +1602,7 @@ static void print_queue_update(int snum, bool force)
|
||||
|
||||
/* finally send the message */
|
||||
|
||||
messaging_send_buf(smbd_messaging_context(),
|
||||
messaging_send_buf(server_messaging_context(),
|
||||
pid_to_procid(background_lpq_updater_pid),
|
||||
MSG_PRINTER_UPDATE, (uint8 *)buffer, len);
|
||||
|
||||
|
@ -407,7 +407,7 @@ static void set_disp_info_cache_timeout(DISP_INFO *disp_info, time_t secs_fromno
|
||||
(unsigned int)secs_fromnow ));
|
||||
|
||||
disp_info->cache_timeout_event = event_add_timed(
|
||||
smbd_event_context(), NULL,
|
||||
server_event_context(), NULL,
|
||||
timeval_current_ofs(secs_fromnow, 0),
|
||||
disp_info_cache_idle_timeout_handler, (void *)disp_info);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user