Changeset 124 for branches/samba-3.0/source/nmbd/nmbd.c
- Timestamp:
- Mar 12, 2008, 9:08:18 AM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/samba-3.0/source/nmbd/nmbd.c
r1 r124 151 151 /************************************************************************** ** 152 152 Reload the list of network interfaces. 153 Doesn't return until a network interface is up. 153 154 ************************************************************************** */ 154 155 155 static BOOLreload_interfaces(time_t t)156 static void reload_interfaces(time_t t) 156 157 { 157 158 static time_t lastt; … … 159 160 struct subnet_record *subrec; 160 161 161 if (t && ((t - lastt) < NMBD_INTERFACES_RELOAD)) return False; 162 if (t && ((t - lastt) < NMBD_INTERFACES_RELOAD)) { 163 return; 164 } 162 165 lastt = t; 163 166 164 if (!interfaces_changed()) return False; 167 if (!interfaces_changed()) { 168 return; 169 } 165 170 166 171 /* the list of probed interfaces has changed, we may need to add/remove 167 172 some subnets */ 168 173 load_interfaces(); 174 175 try_again: 169 176 170 177 /* find any interfaces that need adding */ … … 222 229 } 223 230 } 224 231 225 232 rescan_listen_set = True; 226 233 227 /* We need to shutdownif there are no subnets... */234 /* We need to wait if there are no subnets... */ 228 235 if (FIRST_SUBNET == NULL) { 229 DEBUG(0,("reload_interfaces: No subnets to listen to. Shutting down...\n")); 230 return True; 231 } 232 return False; 236 void (*saved_handler)(int); 237 238 DEBUG(0,("reload_interfaces: " 239 "No subnets to listen to. Waiting..\n")); 240 241 /* 242 * Whilst we're waiting for an interface, allow SIGTERM to 243 * cause us to exit. 244 */ 245 246 saved_handler = CatchSignal( SIGTERM, SIGNAL_CAST SIG_DFL ); 247 248 while (iface_count() == 0) { 249 sleep(5); 250 load_interfaces(); 251 } 252 253 /* 254 * We got an interface, restore our normal term handler. 255 */ 256 257 CatchSignal( SIGTERM, SIGNAL_CAST saved_handler ); 258 goto try_again; 259 } 233 260 } 234 261 … … 268 295 /**************************************************************************** ** 269 296 * React on 'smbcontrol nmbd reload-config' in the same way as to SIGHUP 270 * We use buf here to return BOOL result to process() when reload_interfaces()271 * detects that there are no subnets.272 297 **************************************************************************** */ 273 298 … … 279 304 reload_nmbd_services( True ); 280 305 reopen_logs(); 281 282 if(buf) { 283 /* We were called from process() */ 284 /* If reload_interfaces() returned True */ 285 /* we need to shutdown if there are no subnets... */ 286 /* pass this info back to process() */ 287 *((BOOL*)buf) = reload_interfaces(0); 288 } 306 reload_interfaces(0); 289 307 } 290 308 … … 349 367 { 350 368 BOOL run_election; 351 BOOL no_subnets;352 369 353 370 while( True ) { … … 559 576 DEBUG( 0, ( "Got SIGHUP dumping debug info.\n" ) ); 560 577 msg_reload_nmbd_services(MSG_SMB_CONF_UPDATED, 561 pid_to_procid(0), (void*) &no_subnets, 0, NULL); 562 if(no_subnets) 563 return; 578 pid_to_procid(0), NULL, 0, NULL); 564 579 reload_after_sighup = 0; 565 580 } … … 567 582 /* check for new network interfaces */ 568 583 569 if(reload_interfaces(t)) 570 return; 584 reload_interfaces(t); 571 585 572 586 /* free up temp memory */ 573 587 lp_TALLOC_FREE(); 574 588 } 575 589 }
Note:
See TracChangeset
for help on using the changeset viewer.