even more merges from gerrit

Change-Id: I4cfddc8fd4157ceae353789f2f60d834ec05974e
This commit is contained in:
2022-03-08 10:54:04 +01:00
parent 34b93adef0
commit 7c9296fe2e
9 changed files with 74 additions and 28 deletions

View File

@ -879,6 +879,8 @@ class StructOf(DataType):
:param optional: a list of optional members
:param members: names as keys and types as values for all members
"""
# Remark: assignment of parameters containing partial structs in their datatype
# are (and can) not be handled here! This has to be done manually in the write method
def __init__(self, optional=None, **members):
super().__init__()
self.members = members

View File

@ -253,6 +253,7 @@ class StringIO(IOBase):
if not self.is_connected:
self.read_is_connected() # try to reconnect
if not self._conn:
self.log.debug('can not connect to %r' % self.uri)
raise CommunicationSilentError('can not connect to %r' % self.uri)
try:
with self._lock:
@ -410,7 +411,7 @@ class BytesIO(IOBase):
:return: the full reply (replyheader + additional bytes)
When the reply length is variable, :meth:`communicate` should be called
with the `replylen` argument set to minimum expected length of the reply.
with the `replylen` argument set to the minimum expected length of the reply.
Typically this method determines then the length of additional bytes from
the already received bytes (replyheader) and/or the request and calls
:meth:`readBytes` to get the remaining bytes.

View File

@ -1,6 +1,7 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# *****************************************************************************
#
# This program is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation; either version 2 of the License, or (at your option) any later
@ -17,6 +18,7 @@
#
# Module authors:
# Markus Zolliker <markus.zolliker@psi.ch>
#
# *****************************************************************************

View File

@ -41,7 +41,7 @@ from secop.logging import RemoteLogHandler, HasComlog
generalConfig.defaults['disable_value_range_check'] = False # check for problematic value range by default
Done = UniqueObject('already set')
Done = UniqueObject('Done')
"""a special return value for a read/write function
indicating that the setter is triggered already"""

View File

@ -125,15 +125,22 @@ class Dispatcher:
"""registers new connection"""
self._connections.append(conn)
def remove_connection(self, conn):
"""removes now longer functional connection"""
if conn in self._connections:
self._connections.remove(conn)
def reset_connection(self, conn):
"""remove all subscriptions for a connection
to be called on the identification message
"""
for _evt, conns in list(self._subscriptions.items()):
conns.discard(conn)
self.set_all_log_levels(conn, 'off')
self._active_connections.discard(conn)
def remove_connection(self, conn):
"""removes now longer functional connection"""
if conn in self._connections:
self._connections.remove(conn)
self.reset_connection(conn)
def register_module(self, moduleobj, modulename, export=True):
self.log.debug('registering module %r as %s (export=%r)' %
(moduleobj, modulename, export))
@ -299,6 +306,10 @@ class Dispatcher:
self.log.error('should have been handled in the interface!')
def handle__ident(self, conn, specifier, data):
# Remark: the following line is needed due to issue 66.
self.reset_connection(conn)
# The other stuff in issue 66 ('error_closed' message), has to be implemented
# if and when frappy will support serial server connections
return (IDENTREPLY, None, None)
def handle_describe(self, conn, specifier, data):