### Spine by Chris Alexander

# Standard imports
import time

# Custom imports
import Interface
import Thread

# Output Thread class
class Output(Thread.Interface):

    # Run loop for this thread
    def run(self):
        while True:
            # Fetch something from the queue
            item = self.requestQueue.get()
            if isinstance(item, Thread.Terminator):
                # Terminator received
                if self.interface is not None:
                    # If there is a valid interface still active, shut it down
                    self.interface.shutdown()
                break
            if isinstance(item, Thread.Message):
                # A valid message is found, so process it accordingly
                if self.interface is None or self.interface.host != item.host or self.interface.port != item.port:
                    # Register we are changing name
                    self.setName("_" + item.host + ":" + str(item.port))
                    if self.interface is not None:
                        # Shutdown existing interface if it exists
                        self.interface.shutdown()
                    # Initialise a new Interface
                    self.interface = Interface.Output(item.host, item.port)
                    self.interface.dataformat = self.converter
                    self.interface.transform = self.transform
                    self.interface.initialise()
                    # Change our name
                    self.setName(item.host + ":" + str(item.port))
                self.interface.send(item.message)
                continue
            # Nothing valid found so come back soon
            time.sleep(self.sleepTime)
8a761f34df033207b0fbd82d92d81c31c5591876
<mask token>

<mask token>


class Output(Thread.Interface):
    <mask token>

<mask token>


class Output(Thread.Interface):

    def run(self):
        while True:
            item = self.requestQueue.get()
            if isinstance(item, Thread.Terminator):
                if self.interface is not None:
                    self.interface.shutdown()
                break
            if isinstance(item, Thread.Message):
                if (self.interface is None or self.interface.host != item.
                    host or self.interface.port != item.port):
                    self.setName('_' + item.host + ':' + str(item.port))
                    if self.interface is not None:
                        self.interface.shutdown()
                    self.interface = Interface.Output(item.host, item.port)
                    self.interface.dataformat = self.converter
                    self.interface.transform = self.transform
                    self.interface.initialise()
                    self.setName(item.host + ':' + str(item.port))
                self.interface.send(item.message)
                continue
            time.sleep(self.sleepTime)

import time
import Interface
import Thread


class Output(Thread.Interface):

    def run(self):
        while True:
            item = self.requestQueue.get()
            if isinstance(item, Thread.Terminator):
                if self.interface is not None:
                    self.interface.shutdown()
                break
            if isinstance(item, Thread.Message):
                if (self.interface is None or self.interface.host != item.
                    host or self.interface.port != item.port):
                    self.setName('_' + item.host + ':' + str(item.port))
                    if self.interface is not None:
                        self.interface.shutdown()
                    self.interface = Interface.Output(item.host, item.port)
                    self.interface.dataformat = self.converter
                    self.interface.transform = self.transform
                    self.interface.initialise()
                    self.setName(item.host + ':' + str(item.port))
                self.interface.send(item.message)
                continue
            time.sleep(self.sleepTime)

### Spine by Chris Alexander

# Standard imports
import time

# Custom imports
import Interface
import Thread

# Output Thread class
class Output(Thread.Interface):

    # Run loop for this thread
    def run(self):
        while True:
            # Fetch something from the queue
            item = self.requestQueue.get()
            if isinstance(item, Thread.Terminator):
                # Terminator received
                if self.interface is not None:
                    # If there is a valid interface still active, shut it down
                    self.interface.shutdown()
                break
            if isinstance(item, Thread.Message):
                # A valid message is found, so process it accordingly
                if self.interface is None or self.interface.host != item.host or self.interface.port != item.port:
                    # Register we are changing name
                    self.setName("_" + item.host + ":" + str(item.port))
                    if self.interface is not None:
                        # Shutdown existing interface if it exists
                        self.interface.shutdown()
                    # Initialise a new Interface
                    self.interface = Interface.Output(item.host, item.port)
                    self.interface.dataformat = self.converter
                    self.interface.transform = self.transform
                    self.interface.initialise()
                    # Change our name
                    self.setName(item.host + ":" + str(item.port))
                self.interface.send(item.message)
                continue
            # Nothing valid found so come back soon
            time.sleep(self.sleepTime)