improve error handling on client connections

- send a heartbeat, if no events for 5 sec.
  an interrupted connection (not closed by the other end) may
  not be detected for a long time when nothing is sent
+ make the error reply on a non SECoPEror more verbose
  e.g. "KeyError('foo')" instead of just "foo"
+ allow cfg file without nodeinterface
+ shorter logger name in HasIodev

Change-Id: I6b1ff23f9bf8c96feb25af44935596437b7d726f
Reviewed-on: https://forge.frm2.tum.de/review/c/sine2020/secop/playground/+/23098
Tested-by: JenkinsCodeReview <bjoern_pedersen@frm2.tum.de>
Reviewed-by: Markus Zolliker <markus.zolliker@psi.ch>
This commit is contained in:
2020-05-15 14:21:34 +02:00
parent 5c33cbf7a5
commit 7953826fac
5 changed files with 23 additions and 8 deletions

View File

@ -100,8 +100,8 @@ class Server:
cfgdict = self.loadCfgFile(filename)
ambiguous_sections |= set(merged_cfg) & set(cfgdict)
merged_cfg.update(cfgdict)
self.node_cfg = merged_cfg.pop('NODE')
self.interface_cfg = merged_cfg.pop('INTERFACE')
self.node_cfg = merged_cfg.pop('NODE', {})
self.interface_cfg = merged_cfg.pop('INTERFACE', {})
self.module_cfg = merged_cfg
if interface:
ambiguous_sections.discard('interface')
@ -109,6 +109,8 @@ class Server:
self.node_cfg['name'] = name
self.node_cfg['id'] = cfgfiles
self.interface_cfg['uri'] = str(interface)
elif 'uri' not in self.interface_cfg:
raise ConfigError('missing interface uri')
if ambiguous_sections:
self.log.warning('ambiguous sections in %s: %r' % (cfgfiles, tuple(ambiguous_sections)))
self._cfgfiles = cfgfiles