diff options
author | Aldo Cortesi <aldo@nullcube.com> | 2018-05-02 13:38:16 +1200 |
---|---|---|
committer | Aldo Cortesi <aldo@nullcube.com> | 2018-05-02 14:29:15 +1200 |
commit | f380a77deedbc4c11f11f273384d5fdf14d3f4fe (patch) | |
tree | 2cb91cf83faa58bb921f816996ce5f676dfe406c /mitmproxy | |
parent | 2f3ba1f66dca70764f7d081aa6836d34bbe963c8 (diff) | |
download | mitmproxy-f380a77deedbc4c11f11f273384d5fdf14d3f4fe.tar.gz mitmproxy-f380a77deedbc4c11f11f273384d5fdf14d3f4fe.tar.bz2 mitmproxy-f380a77deedbc4c11f11f273384d5fdf14d3f4fe.zip |
Remove the tick event
Mitmproxy: the tickless wonder.
Diffstat (limited to 'mitmproxy')
-rw-r--r-- | mitmproxy/eventsequence.py | 1 | ||||
-rw-r--r-- | mitmproxy/master.py | 14 | ||||
-rw-r--r-- | mitmproxy/script/concurrent.py | 2 | ||||
-rw-r--r-- | mitmproxy/tools/console/master.py | 16 |
4 files changed, 11 insertions, 22 deletions
diff --git a/mitmproxy/eventsequence.py b/mitmproxy/eventsequence.py index ef3b6db4..79b1bed4 100644 --- a/mitmproxy/eventsequence.py +++ b/mitmproxy/eventsequence.py @@ -36,7 +36,6 @@ Events = frozenset([ "log", "load", "running", - "tick", "update", ]) diff --git a/mitmproxy/master.py b/mitmproxy/master.py index c0f6e86f..20ac6acd 100644 --- a/mitmproxy/master.py +++ b/mitmproxy/master.py @@ -53,7 +53,6 @@ class Master: self.commands = command.CommandManager(self) self.addons = addonmanager.AddonManager(self) self._server = None - self.first_tick = True self.waiting_flows = [] self.log = log.Log(self) @@ -75,19 +74,12 @@ class Master: if self.server: ServerThread(self.server).start() - async def tick(self): - if self.first_tick: - self.first_tick = False - self.addons.trigger("running") - while True: - if self.should_exit.is_set(): - return - self.addons.trigger("tick") - await asyncio.sleep(0.1) + async def running(self): + self.addons.trigger("running") def run_loop(self, loop): self.start() - asyncio.ensure_future(self.tick()) + asyncio.ensure_future(self.running()) exc = None try: diff --git a/mitmproxy/script/concurrent.py b/mitmproxy/script/concurrent.py index 217fab9d..4028f2f4 100644 --- a/mitmproxy/script/concurrent.py +++ b/mitmproxy/script/concurrent.py @@ -12,7 +12,7 @@ class ScriptThread(basethread.BaseThread): def concurrent(fn): - if fn.__name__ not in eventsequence.Events - {"load", "configure", "tick"}: + if fn.__name__ not in eventsequence.Events - {"load", "configure"}: raise NotImplementedError( "Concurrent decorator not supported for '%s' method." % fn.__name__ ) diff --git a/mitmproxy/tools/console/master.py b/mitmproxy/tools/console/master.py index 9ed73ce9..c13bff27 100644 --- a/mitmproxy/tools/console/master.py +++ b/mitmproxy/tools/console/master.py @@ -90,15 +90,13 @@ class ConsoleMaster(master.Master): if log.log_tier(self.options.console_eventlog_verbosity) < log.log_tier(entry.level): return if entry.level in ("error", "warn", "alert"): - if self.first_tick: - self.start_err = entry - else: - signals.status_message.send( - message=(entry.level, - "{}: {}".format(entry.level.title(), - str(entry.msg).lstrip())), - expire=5 - ) + signals.status_message.send( + message = ( + entry.level, + "{}: {}".format(entry.level.title(), str(entry.msg).lstrip()) + ), + expire=5 + ) def sig_call_in(self, sender, seconds, callback, args=()): def cb(*_): |