Example #1
0
 def action(self):
     data = self.recv()
     if data:
         self.sink.setNext(data)
         self.counter += 1
         debugout(self, "counter", self.counter)
         if self.counter == self.max:
             Task.shutdown.set()
             self.notify()
Example #2
0
    def start(self):
        assert self.proc == None, "application already started"

        cmdline = [self.command]
        for k, v in self.params:
            cmdline.append("-" + k)
            cmdline.append(str(v))

        debugout("starting application", cmdline)
        self.proc = subprocess.Popen(cmdline)
Example #3
0
 def wait(self):
     debugout("waiting for application to quit")
     self.proc.wait()
Example #4
0
 def createSocket(self):
     s = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
     debugout(self, "accessing socket", self.fn)
     s.connect(self.fn)
     self.sock = s
Example #5
0
 def __init__(self, fn):
     Socket.__init__(self, fn)
     self.lsock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
     self.lsock.bind(self.fn)
     self.lsock.listen(1)
     debugout(self, "socket created", self.fn)
Example #6
0
 def join(self):
     debugout(self, "joining...")
     Thread.join(self)
     debugout(self, "joined")
Example #7
0
 def sync(self):
     debugout(self, "syncing...")
     self.setup.wait()
     debugout(self, "synced")
Example #8
0
 def start(self):
     debugout(self, "starting...")
     Thread.start(self)
     debugout(self, "started")