Esempio n. 1
0
 def createClient(self):
     '''Create a UAC and add additional attributes: queue and gen.'''
     self._ua = rfc3261_IPv6.UserAgent(self._stack)
     self._ua.autoack = False
     self._ua.scheme = self._stack.transport.secure and 'sips' or 'sip'
     self._ua.localParty, self._ua.remoteParty, self._ua.remoteTarget = self.localParty.dup(
     ), self.remoteParty.dup(), self.remoteTarget.dup()
     # For multitask
     self._ua.queue = multitask.Queue()
     self._ua.gen = None
     return self
Esempio n. 2
0
 def __init__(self, sock):  # similar to the Client class of rtmp.py
     Protocol.__init__(self, sock)
     self.streams, self.objectEncoding, self._nextCallId, self.queue, self.close_queue = {}, 0.0, 1, multitask.SmartQueue(), multitask.Queue()
Esempio n. 3
0
import multitask


def pingponger(get_queue, put_queue, message):
    while True:
        print(yield get_queue.get())
        yield put_queue.put(message)


if __name__ == '__main__':
    ping_queue = multitask.Queue()
    pong_queue = multitask.Queue(['PING'])

    multitask.add(pingponger(ping_queue, pong_queue, 'PING'))
    multitask.add(pingponger(pong_queue, ping_queue, 'PONG'))
    multitask.run()