Changeset 862 for trunk/server/source3/printing/printing.c
- Timestamp:
- May 13, 2014, 11:39:04 AM (11 years ago)
- Location:
- trunk/server
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/server
- Property svn:mergeinfo changed
/vendor/current merged: 860
- Property svn:mergeinfo changed
-
trunk/server/source3/printing/printing.c
r751 r862 1661 1661 } 1662 1662 1663 /**************************************************************************** 1664 Notify smbds of new printcap data 1665 **************************************************************************/ 1666 static void reload_pcap_change_notify(struct tevent_context *ev, 1667 struct messaging_context *msg_ctx) 1668 { 1669 /* 1670 * Reload the printers first in the background process so that 1671 * newly added printers get default values created in the registry. 1672 * 1673 * This will block the process for some time (~1 sec per printer), but 1674 * it doesn't block smbd's servering clients. 1675 */ 1676 reload_printers_full(ev, msg_ctx); 1677 1678 message_send_all(msg_ctx, MSG_PRINTER_PCAP, NULL, 0, NULL); 1679 } 1680 1663 1681 static bool printer_housekeeping_fn(const struct timeval *now, 1664 1682 void *private_data) … … 1683 1701 } 1684 1702 1703 static void printing_sig_term_handler(struct tevent_context *ev, 1704 struct tevent_signal *se, 1705 int signum, 1706 int count, 1707 void *siginfo, 1708 void *private_data) 1709 { 1710 exit_server_cleanly("termination signal"); 1711 } 1712 1713 static void printing_sig_hup_handler(struct tevent_context *ev, 1714 struct tevent_signal *se, 1715 int signum, 1716 int count, 1717 void *siginfo, 1718 void *private_data) 1719 { 1720 struct messaging_context *msg_ctx = talloc_get_type_abort( 1721 private_data, struct messaging_context); 1722 1723 DEBUG(1,("Reloading printers after SIGHUP\n")); 1724 pcap_cache_reload(ev, msg_ctx, 1725 &reload_pcap_change_notify); 1726 } 1727 1728 static void printing_conf_updated(struct messaging_context *msg, 1729 void *private_data, 1730 uint32_t msg_type, 1731 struct server_id server_id, 1732 DATA_BLOB *data) 1733 { 1734 DEBUG(5,("Reloading printers after conf change\n")); 1735 pcap_cache_reload(messaging_event_context(msg), msg, 1736 &reload_pcap_change_notify); 1737 } 1738 1739 1685 1740 static pid_t background_lpq_updater_pid = -1; 1686 1741 … … 1718 1773 int ret; 1719 1774 NTSTATUS status; 1775 struct tevent_signal *se; 1720 1776 1721 1777 /* Child. */ … … 1732 1788 } 1733 1789 1734 smbd_setup_sig_term_handler(); 1735 smbd_setup_sig_hup_handler(ev, msg_ctx); 1790 se = tevent_add_signal(ev, ev, SIGTERM, 0, 1791 printing_sig_term_handler, 1792 NULL); 1793 if (se == NULL) { 1794 smb_panic("failed to setup SIGTERM handler"); 1795 } 1796 se = tevent_add_signal(ev, ev, SIGHUP, 0, 1797 printing_sig_hup_handler, 1798 msg_ctx); 1799 if (se == NULL) { 1800 smb_panic("failed to setup SIGHUP handler"); 1801 } 1736 1802 1737 1803 if (!serverid_register(procid_self(), … … 1747 1813 messaging_register(msg_ctx, NULL, MSG_PRINTER_UPDATE, 1748 1814 print_queue_receive); 1815 messaging_register(msg_ctx, NULL, MSG_SMB_CONF_UPDATED, 1816 printing_conf_updated); 1749 1817 1750 1818 fde = tevent_add_fd(ev, ev, pause_pipe[1], TEVENT_FD_READ, … … 1755 1823 smb_panic("tevent_add_fd() failed for pause_pipe"); 1756 1824 } 1825 1826 /* reload on startup to ensure parent smbd is refreshed */ 1827 pcap_cache_reload(server_event_context(), 1828 smbd_messaging_context(), 1829 &reload_pcap_change_notify); 1757 1830 1758 1831 if (!(event_add_idle(ev, NULL,
Note:
See TracChangeset
for help on using the changeset viewer.