def _monitor_socket(self):
"""Monitor the local socket for connections.
AE.start(): Monitors the local socket to see if anyone tries to connect
and if so, creates a new association. Separated out from start() to
enable better unit testing
"""
# FIXME: this needs to be dealt with properly
try:
read_list, _, _ = select.select([self.local_socket], [], [], 0)
except (socket.error, ValueError):
return
# If theres a connection
if read_list:
client_socket, _ = self.local_socket.accept()
client_socket.setsockopt(socket.SOL_SOCKET,
socket.SO_RCVTIMEO,
pack('ll', 10, 0))
# Create a new Association
# Association(local_ae, local_socket=None, max_pdu=16382)
assoc = Association(self,
client_socket,
max_pdu=self.maximum_pdu_size,
acse_timeout=self.acse_timeout,
dimse_timeout=self.dimse_timeout)
assoc.start()
self.active_associations.append(assoc)
评论列表
文章目录