From 48573483611efadc9f832ddadbcefd3b3f0c6986 Mon Sep 17 00:00:00 2001 From: Brian Warner Date: Fri, 3 Jun 2016 22:32:52 -0700 Subject: [PATCH 1/5] fix display-timeline JS for new message format --- misc/web/timeline.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/misc/web/timeline.js b/misc/web/timeline.js index f1033c0..0314878 100644 --- a/misc/web/timeline.js +++ b/misc/web/timeline.js @@ -184,8 +184,8 @@ d3.json("data.json", function(d) { } else if (ev.name === "ws_receive") { if (ev.details.message.type !== "message") return; - id = ev.details.message.message.id; - phase = ev.details.message.message.phase; + id = ev.details.message.id; + phase = ev.details.message.phase; } else return; @@ -205,7 +205,7 @@ d3.json("data.json", function(d) { cm.tx_x = x_offset(TX_COLUMN, ev.side_name); cm.tx_side_name = ev.side_name; } else { // message - cm.server_rx = ev.details.message.message.server_rx - first; + cm.server_rx = ev.details.message.server_rx - first; cm.arrivals.push({server_tx: ev.details.message.server_tx - first, rx: ev.start, rx_x: x_offset(RX_COLUMN, ev.side_name)}); From a0ce9123052d6dce3924c8b55d2b75c378f8de9f Mon Sep 17 00:00:00 2001 From: Brian Warner Date: Fri, 3 Jun 2016 22:34:28 -0700 Subject: [PATCH 2/5] JS: move unused code out of the way --- misc/web/timeline.js | 37 +++++++++++++++++++++---------------- 1 file changed, 21 insertions(+), 16 deletions(-) diff --git a/misc/web/timeline.js b/misc/web/timeline.js index 0314878..f3e6fd1 100644 --- a/misc/web/timeline.js +++ b/misc/web/timeline.js @@ -703,7 +703,26 @@ d3.json("data.json", function(d) { redraw(); - return; +}); + +/* +TODO + +* identify the largest gaps in the timeline (biggest is probably waiting for + the recipient to start the program, followed by waiting for recipient to + type in code, followed by waiting for recipient to approve transfer, with + the time of actual transfer being anywhere among the others). +* identify groups of events that are separated by those gaps +* put a [1 2 3 4 all] set of buttons at the top of the page +* clicking on each button will zoom the display to 10% beyond the span of + events in the given group, or reset the zoom to include all events + +*/ + + +function OFF() { + /* leftover code from an older implementation, retained since there might + still be some useful pieces here */ function y_off(d) { @@ -1036,18 +1055,4 @@ d3.json("data.json", function(d) { redraw(); $.get("done", function(_) {}); -}); - -/* -TODO - -* identify the largest gaps in the timeline (biggest is probably waiting for - the recipient to start the program, followed by waiting for recipient to - type in code, followed by waiting for recipient to approve transfer, with - the time of actual transfer being anywhere among the others). -* identify groups of events that are separated by those gaps -* put a [1 2 3 4 all] set of buttons at the top of the page -* clicking on each button will zoom the display to 10% beyond the span of - events in the given group, or reset the zoom to include all events - -*/ +} From 3964d4c646a88cbea12dd54424dee02727ce5c40 Mon Sep 17 00:00:00 2001 From: Brian Warner Date: Fri, 3 Jun 2016 22:39:29 -0700 Subject: [PATCH 3/5] JS: highlight dots and lines together --- misc/web/timeline.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/misc/web/timeline.js b/misc/web/timeline.js index f3e6fd1..d4cf0a8 100644 --- a/misc/web/timeline.js +++ b/misc/web/timeline.js @@ -508,7 +508,7 @@ d3.json("data.json", function(d) { chart.selectAll("circle.c2c").filter(d => d.col == dot.col) .attr("r", 10); chart.selectAll("line.c2c") - .classed("active", d => d[2] == dot.col); + .classed("active", d => d.col == dot.col); }) .on("mouseout", dot => { tip.hide(dot); From a1ce0d8df099df99014b064826db0ec86e458ecb Mon Sep 17 00:00:00 2001 From: Brian Warner Date: Fri, 3 Jun 2016 22:55:52 -0700 Subject: [PATCH 4/5] record websocket establishment in timing data --- src/wormhole/wormhole.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/wormhole/wormhole.py b/src/wormhole/wormhole.py index 7392433..2ae41dd 100644 --- a/src/wormhole/wormhole.py +++ b/src/wormhole/wormhole.py @@ -223,6 +223,7 @@ class _Wormhole: self._side = bytes_to_hexstr(os.urandom(5)) self._connection_state = CLOSED self._connection_waiters = [] + self._ws_t = None self._started_get_code = False self._get_code = None self._started_input_code = False @@ -350,6 +351,7 @@ class _Wormhole: # state assert self._side self._connection_state = OPENING + self._ws_t = self._timing.add("open websocket") p = urlparse(self._ws_url) f = WSFactory(self._ws_url) f.wormhole = self @@ -369,7 +371,7 @@ class _Wormhole: def _event_connected(self, ws): self._ws = ws - self._ws_t = self._timing.add("websocket") + self._ws_t.finish() def _event_ws_opened(self, _): self._connection_state = OPEN From b0f2b24ab2cc7240e41f08e83e2d20a7d89fe9d7 Mon Sep 17 00:00:00 2001 From: Brian Warner Date: Fri, 3 Jun 2016 22:56:27 -0700 Subject: [PATCH 5/5] render websocket establishment in timeline --- misc/web/timeline.css | 4 ++++ misc/web/timeline.js | 3 +++ 2 files changed, 7 insertions(+) diff --git a/misc/web/timeline.css b/misc/web/timeline.css index d527f12..44bae10 100644 --- a/misc/web/timeline.css +++ b/misc/web/timeline.css @@ -48,6 +48,10 @@ rect.proc-span-import { fill: #fcc; } +rect.proc-span-websocket { + fill: #cfc; +} + rect.api { fill: #cfc; } diff --git a/misc/web/timeline.js b/misc/web/timeline.js index d4cf0a8..9cf621e 100644 --- a/misc/web/timeline.js +++ b/misc/web/timeline.js @@ -57,6 +57,7 @@ const server_message_color = { const proc_map = { "command dispatch": "dispatch", + "open websocket": "websocket", "code established": "code-established", "key established": "key-established", "transit connected": "transit-connected", @@ -135,6 +136,8 @@ d3.json("data.json", function(d) { if (proc_map[e.name]) { rel_e.category = "proc"; rel_e.x = x_offset(3, side_name); + if (e.name === "open websocket") + rel_e.x = x_offset(4, side_name); rel_e.text = proc_map[e.name]; if (e.name === "import") rel_e.text += " " + e.details.which;