Fixed the GUI memory leak when ONOS is not running.
When the REST call fails because ONOS is not running, there was a Python
exception which somehow caused memory not to be released. Error handling has
been improved to prevent this issue.
Change-Id: Ic05adc24281e7f31d44f6c3a31dca7060251b5f5
diff --git a/web/simple_web_server.py b/web/simple_web_server.py
index 3abd0b0..b47de6b 100755
--- a/web/simple_web_server.py
+++ b/web/simple_web_server.py
@@ -54,11 +54,13 @@
try:
response = urlopen(url)
except URLError, e:
- print "ONOS REST IF %s has issue. Reason: %s" % (url, e.reason)
- result = ""
+ errorString = "Could not access ONOS resource %s: %s" % (url, e.reason)
+ print errorString
+ return errorString, 500
except HTTPError, e:
- print "ONOS REST IF %s has issue. Code %s" % (url, e.code)
- result = ""
+ errorString = "Error during ONOS resource request %s: %s" % (url, e.code)
+ print errorString
+ return errorString, e.code
result = response.read()
return result