Skip to content
Snippets Groups Projects
Commit 8a65d1f1 authored by Manuela Kuhn's avatar Manuela Kuhn
Browse files

Fixed context in dataTransferAPI

parent 99471405
No related branches found
No related tags found
No related merge requests found
...@@ -38,8 +38,11 @@ class dataTransfer(): ...@@ -38,8 +38,11 @@ class dataTransfer():
# and then using that for creating sockets # and then using that for creating sockets
# (source: ZeroMQ, Messaging for Many Applications by Pieter Hintjens) # (source: ZeroMQ, Messaging for Many Applications by Pieter Hintjens)
if context: if context:
self.context = context self.context = context
self.externalContext = True self.extContext = True
else:
self.context = zmq.Context()
self.extContext = False
self.signalHost = signalHost self.signalHost = signalHost
...@@ -78,8 +81,8 @@ class dataTransfer(): ...@@ -78,8 +81,8 @@ class dataTransfer():
raise Excepition("Argument 'targets' must be list.") raise Excepition("Argument 'targets' must be list.")
if not self.context: if not self.context:
self.context = zmq.Context() self.context = zmq.Context()
self.externalContext = False self.extContext = False
signal = None signal = None
# Signal exchange # Signal exchange
...@@ -540,7 +543,7 @@ class dataTransfer(): ...@@ -540,7 +543,7 @@ class dataTransfer():
# if the context was created inside this class, # if the context was created inside this class,
# it has to be destroyed also within the class # it has to be destroyed also within the class
if not self.externalContext and self.context: if not self.extContext and self.context:
try: try:
self.log.info("Closing ZMQ context...") self.log.info("Closing ZMQ context...")
self.context.destroy(0) self.context.destroy(0)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment