Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
scenario,
self._endpoint,
self._endpoint_ssl_cert,
self._endpoint_ssl_key,
*scenario_args[0],
**scenario_args[1]
)
self._harnesses.append(harness)
iterations = quantity / stagger
for delay in range(iterations):
def runall():
for _ in range(stagger):
harness.run()
self._queued_calls -= 1
self._queued_calls += 1
reactor.callLater(overall_delay+delay, runall)
def topicUpdated(self, user, channel, newTopic):
wlog('topicUpdated: ', user, channel, newTopic)
if self.wrapper.on_set_topic:
reactor.callLater(0.0, self.wrapper.on_set_topic, newTopic)
@defer.inlineCallbacks
def _start(self):
yield self._nuke_old_streams()
reactor.callLater(1, self._cycle)
def _register_quiet(self, sender, duration):
quiet = Quiet()
quiet.user = make_short_name(sender)
quiet.expirator = reactor.callLater(
duration,
self._deregister_quiet,
sender
)
quiet.expiration = (datetime.datetime.now() +
datetime.timedelta(seconds=duration))
self.quiets[sender] = quiet
def shutdown():
print "shutting down in 3 seconds"
if dc.active():
dc.cancel()
reactor.callLater(1, printer, "2...")
reactor.callLater(2, printer, "1...")
reactor.callLater(3, printer, "0...")
d = defer.Deferred()
reactor.callLater(3, d.callback, 1)
return d
def _sendLine(self):
if self._queue:
self._reallySendLine(self._queue.pop(0))
self._queueEmptying = reactor.callLater(self.lineRate,
self._sendLine)
else:
self._queueEmptying = None
def callLater(self, period, func):
"""
Wrapper around L{reactor.callLater} for test purpose.
"""
from twisted.internet import reactor
return reactor.callLater(period, func)
def activate(self):
from twisted.internet import reactor
self._callLater = reactor.callLater
def onMessage(self, payload, isBinary):
if not isBinary:
print("Text message received: {}".format(payload.decode('utf8')))
reactor.callLater(1, self.sendHello)
for f in flows:
if f.table_id == table_id:
# FIXME
if fd.get_in_port(f) == fd.get_in_port(flow) and \
fd.get_out_port(f) == port:
next_flows.append(f)
if len(next_flows) == 0:
self.log.warning('no next flow found, it may be a timing issue',
flow=flow, number_of_flows=len(flows))
if flow.id in self.retry_add_flow_list:
self.log.debug('flow is already in retry list',
flow_id=flow.id)
else:
self.retry_add_flow_list.append(flow.id)
reactor.callLater(5, self.retry_add_flow, flow)
return None
next_flows.sort(key=lambda f: f.priority, reverse=True)
return next_flows[0]