donate-cpu-server.py: if a Python exception was raised return it instead of just closing the connection (#3130)

This commit is contained in:
Oliver Stöneberg 2021-02-14 16:16:28 +01:00 committed by GitHub
parent 70511464f5
commit e219596797
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 1 deletions

View File

@ -11,6 +11,7 @@ import socket
import re import re
import datetime import datetime
import time import time
import traceback
from threading import Thread from threading import Thread
import sys import sys
import urllib.request import urllib.request
@ -24,7 +25,7 @@ import html as html_lib
# Version scheme (MAJOR.MINOR.PATCH) should orientate on "Semantic Versioning" https://semver.org/ # Version scheme (MAJOR.MINOR.PATCH) should orientate on "Semantic Versioning" https://semver.org/
# Every change in this script should result in increasing the version number accordingly (exceptions may be cosmetic # Every change in this script should result in increasing the version number accordingly (exceptions may be cosmetic
# changes) # changes)
SERVER_VERSION = "1.3.14" SERVER_VERSION = "1.3.15"
OLD_VERSION = '2.3' OLD_VERSION = '2.3'
@ -913,6 +914,10 @@ class HttpClientThread(Thread):
data = f.read() data = f.read()
f.close() f.close()
httpGetResponse(self.connection, data, 'text/plain') httpGetResponse(self.connection, data, 'text/plain')
except:
tb = "".join(traceback.format_exception(sys.exc_info()[0], sys.exc_info()[1], sys.exc_info()[2]))
print(tb)
httpGetResponse(self.connection, tb, 'text/plain')
finally: finally:
time.sleep(1) time.sleep(1)
self.connection.close() self.connection.close()