Rev 749 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | SVN | RSS feed
| Rev 749 | Rev 750 | ||
|---|---|---|---|
| Line 296... | Line 296... | ||
| 296 | """load config defaults, or last config if exists""" |
296 | """load config defaults, or last config if exists""" |
| 297 | """run startup.cfg""" |
297 | """run startup.cfg""" |
| 298 | print 'INIT: Loading daemon configuration' |
298 | print 'INIT: Loading daemon configuration' |
| 299 | self.cfg = DaemonConfig() |
299 | self.cfg = DaemonConfig() |
| 300 | self.cfg.load() |
300 | self.cfg.load() |
| - | 301 | ||
| - | 302 | # create interface for debugging purpose |
|
| - | 303 | self.cfg.addInterface('tcp', None) |
|
| 301 | 304 | ||
| 302 | self.ifNotifier = self.IfNotifier(self) |
305 | self.ifNotifier = self.IfNotifier(self) |
| 303 | for nodeIf in self.cfg.nodeInterfaces: |
306 | for nodeIf in self.cfg.nodeInterfaces: |
| 304 | nodeIf.setIfNotifier(self.ifNotifier) |
307 | nodeIf.setIfNotifier(self.ifNotifier) |
| 305 | 308 | ||
| Line 314... | Line 317... | ||
| 314 | 'or that you do not have permission to access it.' |
317 | 'or that you do not have permission to access it.' |
| 315 | sys.exit(-1) |
318 | sys.exit(-1) |
| 316 | 319 | ||
| 317 | print 'INIT: Initialize/gather info on connected can nodes and load associated state' |
320 | print 'INIT: Initialize/gather info on connected can nodes and load associated state' |
| 318 | print 'INIT: Starting configured servers' |
321 | print 'INIT: Starting configured servers' |
| 319 | 322 | ||
| 320 | print 'CanDaemon v1 ready' |
323 | print 'CanDaemon v1 ready' |
| 321 | print 'Enter command or type \"help\" for a list of commands' |
324 | print 'Enter command or type \"help\" for a list of commands' |
| 322 | while not self.terminated: |
325 | while not self.terminated: |
| 323 | input = raw_input('> ') |
326 | input = raw_input('> ') |
| 324 | self.parseCommand(input) |
327 | self.parseCommand(input) |
| 325 | 328 | ||
| 326 | print 'Shutdown' |
329 | print 'Shutdown' |
| 327 | self.cfg.save() |
330 | self.cfg.save() |
| 328 | 331 | ||
| 329 | for nodeIf in self.cfg.nodeInterfaces: |
332 | for nodeIf in self.cfg.nodeInterfaces: |
| 330 | if |
333 | if nodeIf.running(): |
| 331 | print 'Stopping If thread' |
334 | print 'Stopping If thread' |
| 332 |
|
335 | nodeIf.stop() |
| 333 | 336 | ||
| 334 | print 'Waiting 0.1..' |
337 | print 'Waiting 0.1..' |
| 335 | time.sleep(0.1) # wait for threads |
338 | time.sleep(0.1) # wait for threads |
| 336 | print 'Terminating' |
339 | print 'Terminating' |
| 337 | sys.exit(0) # will except if there are threads remaining |
340 | sys.exit(0) # will except if there are threads remaining |