From 89971478489afe7e417ec065af5ce9934facd429 Mon Sep 17 00:00:00 2001 From: Kristaps Kaupe Date: Wed, 20 May 2020 20:18:57 +0300 Subject: [PATCH 1/4] Terminate ob-watcher immediately if HTTP server fails to start --- scripts/obwatch/ob-watcher.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/scripts/obwatch/ob-watcher.py b/scripts/obwatch/ob-watcher.py index 4c102b2..1088a6e 100644 --- a/scripts/obwatch/ob-watcher.py +++ b/scripts/obwatch/ob-watcher.py @@ -372,8 +372,12 @@ class HTTPDThread(threading.Thread): def run(self): # hostport = ('localhost', 62601) - httpd = http.server.HTTPServer(self.hostport, + try: + httpd = http.server.HTTPServer(self.hostport, OrderbookPageRequestHeader) + except Exception as e: + print("Failed to start HTTP server: " + str(e)) + os._exit(EXIT_FAILURE) httpd.taker = self.taker print('\nstarted http server, visit http://{0}:{1}/\n'.format( *self.hostport)) From 80333b28720bd636603f819645ad17eefbdba354 Mon Sep 17 00:00:00 2001 From: Kristaps Kaupe Date: Wed, 20 May 2020 20:30:20 +0300 Subject: [PATCH 2/4] Make ob-watcher independent of current working directory --- scripts/obwatch/ob-watcher.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scripts/obwatch/ob-watcher.py b/scripts/obwatch/ob-watcher.py index 1088a6e..83a8aab 100644 --- a/scripts/obwatch/ob-watcher.py +++ b/scripts/obwatch/ob-watcher.py @@ -271,7 +271,8 @@ class OrderbookPageRequestHeader(http.server.SimpleHTTPRequestHandler): pages = ['/', '/ordersize', '/depth', '/orderbook.json'] if self.path not in pages: return - fd = open('orderbook.html', 'r') + fd = open(os.path.join(os.path.dirname(os.path.realpath(__file__)), + 'orderbook.html'), 'r') orderbook_fmt = fd.read() fd.close() alert_msg = '' From e8ec595d31b8e7920c5923dff100ca43466595d7 Mon Sep 17 00:00:00 2001 From: Kristaps Kaupe Date: Wed, 20 May 2020 20:31:38 +0300 Subject: [PATCH 3/4] Shebang and +x for ob-watcher.py --- scripts/obwatch/ob-watcher.py | 1 + 1 file changed, 1 insertion(+) mode change 100644 => 100755 scripts/obwatch/ob-watcher.py diff --git a/scripts/obwatch/ob-watcher.py b/scripts/obwatch/ob-watcher.py old mode 100644 new mode 100755 index 83a8aab..a87afdb --- a/scripts/obwatch/ob-watcher.py +++ b/scripts/obwatch/ob-watcher.py @@ -1,3 +1,4 @@ +#!/usr/bin/env python3 from future.utils import iteritems from past.builtins import cmp from functools import cmp_to_key From 6bd101ebb32ad4ca4af1c3fd6fb4a3db335e4188 Mon Sep 17 00:00:00 2001 From: Kristaps Kaupe Date: Wed, 20 May 2020 23:24:59 +0300 Subject: [PATCH 4/4] Remove link to old non segwit version and change new version link to use JoinMarket github organization --- scripts/obwatch/orderbook.html | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/scripts/obwatch/orderbook.html b/scripts/obwatch/orderbook.html index fd2742f..7c3eb05 100644 --- a/scripts/obwatch/orderbook.html +++ b/scripts/obwatch/orderbook.html @@ -86,8 +86,7 @@
  • Size Distribution
  • Depth
  • Export orders
  • -
  • New segwit version
  • -
  • Non segwit version
  • +
  • New segwit version