diff options
Diffstat (limited to 'source3/nmbd')
-rw-r--r-- | source3/nmbd/nmbd.c | 7 | ||||
-rw-r--r-- | source3/nmbd/nmbd_elections.c | 21 | ||||
-rw-r--r-- | source3/nmbd/nmbd_packets.c | 11 |
3 files changed, 25 insertions, 14 deletions
diff --git a/source3/nmbd/nmbd.c b/source3/nmbd/nmbd.c index 2da879fc94..914f288001 100644 --- a/source3/nmbd/nmbd.c +++ b/source3/nmbd/nmbd.c @@ -312,6 +312,9 @@ static void process(void) { time_t t = time(NULL); + /* check for internal messages */ + message_dispatch(); + /* * Check all broadcast subnets to see if * we need to run an election on any of them. @@ -490,9 +493,6 @@ static void process(void) /* free up temp memory */ lp_talloc_free(); - - /* check for internal messages */ - message_init(); } } /* process */ @@ -795,6 +795,7 @@ static void usage(char *pname) pidfile_create("nmbd"); message_init(); + message_register(MSG_FORCE_ELECTION, nmbd_message_election); DEBUG( 3, ( "Opening sockets %d\n", global_nmb_port ) ); diff --git a/source3/nmbd/nmbd_elections.c b/source3/nmbd/nmbd_elections.c index be38b572f6..522e268ae7 100644 --- a/source3/nmbd/nmbd_elections.c +++ b/source3/nmbd/nmbd_elections.c @@ -381,3 +381,24 @@ yet registered on subnet %s\n", nmb_namestr(&nmbname), subrec->subnet_name )); } return run_any_election; } + + + +/**************************************************************************** +process a internal Samba message forcing an election +***************************************************************************/ +void nmbd_message_election(int msg_type, pid_t src, void *buf, size_t len) +{ + struct subnet_record *subrec; + + for (subrec = FIRST_SUBNET; subrec; subrec = NEXT_SUBNET_EXCLUDING_UNICAST(subrec)) { + struct work_record *work; + for (work = subrec->workgrouplist; work; work = work->next) { + if (strequal(work->work_group, global_myworkgroup)) { + work->needelection = True; + work->ElectionCount=0; + work->mst_state = lp_local_master() ? MST_POTENTIAL : MST_NONE; + } + } + } +} diff --git a/source3/nmbd/nmbd_packets.c b/source3/nmbd/nmbd_packets.c index d1f77fe2d2..50193d5339 100644 --- a/source3/nmbd/nmbd_packets.c +++ b/source3/nmbd/nmbd_packets.c @@ -1759,14 +1759,6 @@ only use %d.\n", (count*2) + 2, FD_SETSIZE)); } /**************************************************************************** -do any signal triggered processing -***************************************************************************/ -static void nmbd_async_processing(void) -{ - message_dispatch(); -} - -/**************************************************************************** Listens for NMB or DGRAM packets, and queues them. return True if the socket is dead ***************************************************************************/ @@ -1826,9 +1818,6 @@ BOOL listen_for_packets(BOOL run_election) BlockSignals(True, SIGTERM); if(selrtn == -1) { - if (errno == EINTR) { - nmbd_async_processing(); - } return False; } |