From a63e1a893bb0ad9b1fa3f81ca7b60823e3d70dcb Mon Sep 17 00:00:00 2001 From: Dorian Niemiec Date: Sun, 12 Nov 2023 20:18:43 +0100 Subject: [PATCH] Update to SVR.JS 3.11.0 --- index.html | 11 ++-- licenses/.index.html.kate-swp | Bin 48 -> 0 bytes licenses/index.html | 8 +-- logviewer.js | 2 +- svr.js | 119 ++++++++++++++++++++++++---------- tests.html | 4 +- 6 files changed, 97 insertions(+), 47 deletions(-) delete mode 100644 licenses/.index.html.kate-swp diff --git a/index.html b/index.html index 5257332..406e420 100644 --- a/index.html +++ b/index.html @@ -1,7 +1,7 @@ - SVR.JS 3.10.3 + SVR.JS 3.11.0 -

Welcome to SVR.JS 3.10.3

+

Welcome to SVR.JS 3.11.0



-

If you see this page, that means, that the server is properly working. You can further configure the server and replace index.html and tests.html pages with custom ones.

+

If you see this page that means that the server is working properly. You can further configure the server and replace index.html and tests.html pages with custom ones.

Default config.json looks like this:

@@ -117,7 +117,10 @@

Changes:


Tests
diff --git a/licenses/.index.html.kate-swp b/licenses/.index.html.kate-swp deleted file mode 100644 index d9b63208857c1223ac41563cb3d78a893fad735d..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 48 zcmZQzU=Z?7EJ;-eE>A2_aLdd|RWQ;sU|?VnDSMD0Ws DJmU{c diff --git a/licenses/index.html b/licenses/index.html index 8746e53..25195d4 100644 --- a/licenses/index.html +++ b/licenses/index.html @@ -1,7 +1,7 @@ - SVR.JS 3.10.3 Licenses + SVR.JS 3.11.0 Licenses -

SVR.JS 3.10.3 Licenses

-

SVR.JS 3.10.3

+

SVR.JS 3.11.0 Licenses

+

SVR.JS 3.11.0

MIT License

@@ -37,7 +37,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
-

Packages used by SVR.JS 3.10.3 and utilities

+

Packages used by SVR.JS 3.11.0 and utilities

License: MIT
diff --git a/logviewer.js b/logviewer.js index 582b65e..57d908b 100644 --- a/logviewer.js +++ b/logviewer.js @@ -20,7 +20,7 @@ for (var i = (process.argv[0].indexOf("node") > -1 || process.argv[0].indexOf("b } } -var logo = ["","",""," \u001b[38;5;002m&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&"," &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&%"," &&\u001b[38;5;243m(((((\u001b[38;5;242m(\u001b[38;5;243m(((\u001b[38;5;241m##(###\u001b[38;5;243m(\u001b[38;5;241m##\u001b[38;5;243m((((((((((((((((((((((\u001b[38;5;143m*\u001b[38;5;243m(((\u001b[38;5;101m/\u001b[38;5;143m/\u001b[38;5;243m(((\u001b[38;5;185m*\u001b[38;5;243m((\u001b[38;5;242m(\u001b[38;5;002m&&"," \u001b[38;5;m&\u001b[38;5;002m&\u001b[38;5;243m((((((\u001b[38;5;242m(\u001b[38;5;243m(((((((\u001b[38;5;241m#\u001b[38;5;243m(((((((((((((((((((((((((\u001b[38;5;011m***\u001b[38;5;244m(\u001b[38;5;185m*\u001b[38;5;011m***\u001b[38;5;243m(\u001b[38;5;011m***\u001b[38;5;243m((\u001b[38;5;002m&&"," \u001b[38;5;m&\u001b[38;5;002m&&&\u001b[38;5;243m((((((((((((((((((((((((((((((((((((((((((((((((((\u001b[38;5;002m&&&&"," \u001b[38;5;m&\u001b[38;5;002m&&\u001b[38;5;243m((((((((((((((((((((((((((((((((((((((((((((((((((((\u001b[38;5;002m&&&"," \u001b[38;5;m&\u001b[38;5;002m&\u001b[38;5;243m((((((\u001b[38;5;241m###\u001b[38;5;243m(((((\u001b[38;5;241m#\u001b[38;5;243m((\u001b[38;5;241m##\u001b[38;5;243m(((((((((((((((((((((\u001b[38;5;011m****\u001b[38;5;015m \u001b[38;5;243m(\u001b[38;5;011m***\u001b[38;5;243m((\u001b[38;5;002m&&"," \u001b[38;5;m&\u001b[38;5;002m&&\u001b[38;5;243m((((((((((((((((((((((((((((((((((((((((((((((((((((\u001b[38;5;002m&&&"," \u001b[38;5;m&\u001b[38;5;002m&&&%\u001b[38;5;243m((((((((((((((((((((((((((((((((((((((((((((((((\u001b[38;5;065m#\u001b[38;5;002m&&&&"," \u001b[38;5;m&\u001b[38;5;002m&\u001b[38;5;243m((((((\u001b[38;5;242m(\u001b[38;5;243m(((((((\u001b[38;5;241m(\u001b[38;5;243m((((\u001b[38;5;242m(\u001b[38;5;243m((((((((((((((((((((\u001b[38;5;015m \u001b[38;5;143m/\u001b[38;5;187m.\u001b[38;5;015m \u001b[38;5;243m(\u001b[38;5;015m \u001b[38;5;243m((\u001b[38;5;002m&&"," \u001b[38;5;m&\u001b[38;5;002m&&\u001b[38;5;243m(((((\u001b[38;5;242m(\u001b[38;5;243m(((((((\u001b[38;5;241m#\u001b[38;5;243m(((((((((((((((((((((((((((((((((((((((\u001b[38;5;002m&&"," \u001b[38;5;m&\u001b[38;5;002m&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&"," \u001b[38;5;m&\u001b[38;5;002m&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&"," \u001b[38;5;m&\u001b[38;5;002m&&&&&&&&\u001b[38;5;010m########################################\u001b[38;5;071m#\u001b[38;5;002m&&&&&&&&"," \u001b[38;5;m&\u001b[38;5;002m&&&&&\u001b[38;5;010m##############################################\u001b[38;5;002m&&&&&&"," \u001b[38;5;m&\u001b[38;5;002m&&&\u001b[38;5;010m##################################################\u001b[38;5;002m&&&&"," \u001b[38;5;m&\u001b[38;5;002m&&\u001b[38;5;010m####\u001b[38;5;016m@@@@@@\u001b[38;5;010m#\u001b[38;5;016m@@\u001b[38;5;010m####\u001b[38;5;016m@@\u001b[38;5;040m#\u001b[38;5;010m#\u001b[38;5;016m@@@@@@@\u001b[38;5;010m###########\u001b[38;5;016m@@\u001b[38;5;010m##\u001b[38;5;016m@@@@@@\u001b[38;5;010m###\u001b[38;5;002m&&&"," \u001b[38;5;m&\u001b[38;5;002m&\u001b[38;5;083m/\u001b[38;5;010m###\u001b[38;5;016m@@\u001b[38;5;010m#######\u001b[38;5;016m@@\u001b[38;5;010m###\u001b[38;5;016m@\u001b[38;5;233m@\u001b[38;5;010m##\u001b[38;5;016m@@\u001b[38;5;010m####\u001b[38;5;016m@@\u001b[38;5;010m##########\u001b[38;5;016m@@\u001b[38;5;010m#\u001b[38;5;016m@@\u001b[38;5;010m#########\u001b[38;5;002m&&"," \u001b[38;5;m&\u001b[38;5;002m&\u001b[38;5;010m#######\u001b[38;5;022m@\u001b[38;5;016m@@@@\u001b[38;5;010m##\u001b[38;5;016m@@\u001b[38;5;010m#\u001b[38;5;016m@@\u001b[38;5;010m###\u001b[38;5;016m@@@@@@@\u001b[38;5;010m#######\u001b[38;5;016m@\u001b[38;5;010m###\u001b[38;5;016m@@\u001b[38;5;010m####\u001b[38;5;040m#\u001b[38;5;016m@@@@\u001b[38;5;010m###\u001b[38;5;002m&&"," \u001b[38;5;m&\u001b[38;5;002m&\u001b[38;5;114m*\u001b[38;5;010m###\u001b[38;5;016m@@\u001b[38;5;010m###\u001b[38;5;002m&\u001b[38;5;016m@@\u001b[38;5;010m###\u001b[38;5;016m@@@\u001b[38;5;010m####\u001b[38;5;016m@@\u001b[38;5;010m####\u001b[38;5;016m@@\u001b[38;5;010m##\u001b[38;5;016m@@\u001b[38;5;010m#\u001b[38;5;034m%\u001b[38;5;010m#\u001b[38;5;016m@@@@\u001b[38;5;010m##\u001b[38;5;016m@@\u001b[38;5;034m%\u001b[38;5;010m###\u001b[38;5;016m@@\u001b[38;5;010m###\u001b[38;5;002m&&"," \u001b[38;5;m&\u001b[38;5;002m&&\u001b[38;5;010m####################################################\u001b[38;5;002m&&&"," \u001b[38;5;m&\u001b[38;5;002m&&&\u001b[38;5;010m##################################################\u001b[38;5;002m&&&&"," \u001b[38;5;m&\u001b[38;5;002m&&&&&\u001b[38;5;010m##############################################\u001b[38;5;002m&&&&&&"," \u001b[38;5;m&\u001b[38;5;002m&&&&&&&&\u001b[38;5;010m########################################\u001b[38;5;002m&&&&&&&&&"," \u001b[38;5;m#\u001b[38;5;002m&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&"," &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&"," &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&"," \u001b[38;5;247m*\u001b[38;5;246m///\u001b[38;5;247m*\u001b[38;5;246m///"," ////\u001b[38;5;247m*\u001b[38;5;246m///"," \u001b[38;5;208m////////"," \u001b[38;5;m&\u001b[38;5;208m(((((/(((("," \u001b[38;5;246m/\u001b[38;5;247m*\u001b[38;5;246m///\u001b[38;5;247m*\u001b[38;5;246m///\u001b[38;5;247m*\u001b[38;5;246m///\u001b[38;5;247m*\u001b[38;5;246m///\u001b[38;5;247m*\u001b[38;5;246m/\u001b[38;5;208m/(/(((/(((/\u001b[38;5;137m/\u001b[38;5;246m//\u001b[38;5;247m*\u001b[38;5;246m///\u001b[38;5;247m*\u001b[38;5;246m///\u001b[38;5;247m*\u001b[38;5;246m///\u001b[38;5;247m*\u001b[38;5;246m///"," //\u001b[38;5;247m*\u001b[38;5;246m///////\u001b[38;5;247m*\u001b[38;5;246m///////\u001b[38;5;247m*\u001b[38;5;246m/\u001b[38;5;208m/(((((/((((\u001b[38;5;137m/\u001b[38;5;246m//\u001b[38;5;247m*\u001b[38;5;246m///////\u001b[38;5;247m*\u001b[38;5;246m///////\u001b[38;5;247m*"," *\u001b[38;5;246m/\u001b[38;5;247m*\u001b[38;5;246m/\u001b[38;5;247m*\u001b[38;5;246m/\u001b[38;5;247m*\u001b[38;5;246m/\u001b[38;5;247m*\u001b[38;5;246m/\u001b[38;5;247m*\u001b[38;5;246m/\u001b[38;5;247m*\u001b[38;5;246m/\u001b[38;5;247m*\u001b[38;5;246m/\u001b[38;5;247m*\u001b[38;5;246m/\u001b[38;5;247m*\u001b[38;5;246m/\u001b[38;5;247m*\u001b[38;5;208m(/(/(/(/(/\u001b[38;5;246m/\u001b[38;5;247m*\u001b[38;5;246m/\u001b[38;5;247m*\u001b[38;5;246m/\u001b[38;5;247m*\u001b[38;5;246m/\u001b[38;5;247m*\u001b[38;5;246m/\u001b[38;5;247m*\u001b[38;5;246m/\u001b[38;5;247m*\u001b[38;5;246m/\u001b[38;5;247m*\u001b[38;5;246m/\u001b[38;5;247m*\u001b[38;5;246m/\u001b[38;5;247m*\u001b[38;5;246m/\u001b[38;5;247m*"," \u001b[38;5;208m((((/(((","","","","\u001b[0m"]; +var logo = ["", "", "", " \x1b[38;5;002m&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&", " &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&", " &&&\x1b[38;5;243m(((((((((((((((((((((((((((((((((((((((((((((((((((\x1b[38;5;002m&&&", " \x1b[38;5;002m&&\x1b[38;5;243m((((((\x1b[38;5;241m###########\x1b[38;5;243m(((((((((((((((((((((((\x1b[38;5;011m***\x1b[38;5;243m(\x1b[38;5;011m***\x1b[38;5;243m(\x1b[38;5;011m***\x1b[38;5;243m((\x1b[38;5;002m&&", " \x1b[38;5;002m&&&\x1b[38;5;243m(((((((((((((((((((((((((((((((((((((((((((((((((((\x1b[38;5;002m&&&", " \x1b[38;5;002m&&&\x1b[38;5;243m(((((((((((((((((((((((((((((((((((((((((((((((((((\x1b[38;5;002m&&&", " \x1b[38;5;002m&&\x1b[38;5;243m((((((\x1b[38;5;241m###########\x1b[38;5;243m(((((((((((((((((((((((\x1b[38;5;011m***\x1b[38;5;243m(\x1b[38;5;015m \x1b[38;5;243m(\x1b[38;5;011m***\x1b[38;5;243m((\x1b[38;5;002m&&", " \x1b[38;5;002m&&&\x1b[38;5;243m(((((((((((((((((((((((((((((((((((((((((((((((((((\x1b[38;5;002m&&&", " \x1b[38;5;002m&&&\x1b[38;5;243m(((((((((((((((((((((((((((((((((((((((((((((((((((\x1b[38;5;002m&&&", " \x1b[38;5;002m&&\x1b[38;5;243m((((((\x1b[38;5;241m###########\x1b[38;5;243m(((((((((((((((((((((((\x1b[38;5;015m \x1b[38;5;243m(\x1b[38;5;015m \x1b[38;5;243m(\x1b[38;5;015m \x1b[38;5;243m((\x1b[38;5;002m&&", " \x1b[38;5;002m&&&\x1b[38;5;243m(((((((((((((((((((((((((((((((((((((((((((((((((((\x1b[38;5;002m&&&", " \x1b[38;5;002m&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&", " \x1b[38;5;002m&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&", " \x1b[38;5;002m&&&&&&&&\x1b[38;5;010m#########################################\x1b[38;5;002m&&&&&&&&", " \x1b[38;5;002m&&&&&\x1b[38;5;010m###############################################\x1b[38;5;002m&&&&&", " \x1b[38;5;002m&&&\x1b[38;5;010m###################################################\x1b[38;5;002m&&&", " \x1b[38;5;002m&&\x1b[38;5;010m####\x1b[38;5;016m@@@@@@\x1b[38;5;010m#\x1b[38;5;016m@@@\x1b[38;5;010m###\x1b[38;5;016m@@@\x1b[38;5;010m#\x1b[38;5;016m@@@@@@@\x1b[38;5;010m###########\x1b[38;5;016m@@\x1b[38;5;010m##\x1b[38;5;016m@@@@@@\x1b[38;5;010m####\x1b[38;5;002m&&", " \x1b[38;5;002m&&\x1b[38;5;010m###\x1b[38;5;016m@@\x1b[38;5;010m#######\x1b[38;5;016m@@\x1b[38;5;010m###\x1b[38;5;016m@@\x1b[38;5;010m##\x1b[38;5;016m@@\x1b[38;5;010m####\x1b[38;5;016m@@\x1b[38;5;010m##########\x1b[38;5;016m@@\x1b[38;5;010m#\x1b[38;5;016m@@\x1b[38;5;010m#########\x1b[38;5;002m&&", " \x1b[38;5;002m&&\x1b[38;5;010m######\x1b[38;5;040m#\x1b[38;5;016m@@@@\x1b[38;5;010m##\x1b[38;5;016m@@\x1b[38;5;010m#\x1b[38;5;016m@@\x1b[38;5;010m###\x1b[38;5;016m@@@@@@@\x1b[38;5;010m#######\x1b[38;5;016m@@\x1b[38;5;010m##\x1b[38;5;016m@@\x1b[38;5;010m####\x1b[38;5;040m#\x1b[38;5;016m@@@@\x1b[38;5;010m###\x1b[38;5;002m&&", " \x1b[38;5;002m&&\x1b[38;5;010m###\x1b[38;5;016m@@\x1b[38;5;034m%\x1b[38;5;010m###\x1b[38;5;016m@@\x1b[38;5;010m###\x1b[38;5;016m@@@\x1b[38;5;010m####\x1b[38;5;016m@@\x1b[38;5;010m####\x1b[38;5;016m@@\x1b[38;5;010m##\x1b[38;5;016m@@\x1b[38;5;010m###\x1b[38;5;016m@@@@\x1b[38;5;010m##\x1b[38;5;016m@@\x1b[38;5;034m%\x1b[38;5;010m###\x1b[38;5;016m@@\x1b[38;5;010m###\x1b[38;5;002m&&", " \x1b[38;5;002m&&\x1b[38;5;010m#####################################################\x1b[38;5;002m&&", " \x1b[38;5;002m&&&\x1b[38;5;010m###################################################\x1b[38;5;002m&&&", " \x1b[38;5;002m&&&&&\x1b[38;5;010m###############################################\x1b[38;5;002m&&&&&", " \x1b[38;5;002m&&&&&&&&\x1b[38;5;010m#########################################\x1b[38;5;002m&&&&&&&&", " \x1b[38;5;002m&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&", " &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&", " &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&", " \x1b[38;5;246m///////", " ///////", " \x1b[38;5;208m((((/))))", " \x1b[38;5;208m(((((/)))))", " \x1b[38;5;246m/\x1b[38;5;247m*\x1b[38;5;246m///\x1b[38;5;247m*\x1b[38;5;246m///\x1b[38;5;247m*\x1b[38;5;246m///\x1b[38;5;247m*\x1b[38;5;246m///\x1b[38;5;247m*\x1b[38;5;246m/\x1b[38;5;247m/\x1b[38;5;208m(((((/)))))\x1b[38;5;246m//\x1b[38;5;247m*\x1b[38;5;246m///\x1b[38;5;247m*\x1b[38;5;246m///\x1b[38;5;247m*\x1b[38;5;246m///\x1b[38;5;247m*\x1b[38;5;246m///\x1b[38;5;247m*\x1b[38;5;246m/", " //\x1b[38;5;247m*\x1b[38;5;246m///////\x1b[38;5;247m*\x1b[38;5;246m///////\x1b[38;5;247m*\x1b[38;5;246m/\x1b[38;5;247m/\x1b[38;5;208m(((((/)))))\x1b[38;5;246m//\x1b[38;5;247m*\x1b[38;5;246m///////\x1b[38;5;247m*\x1b[38;5;246m///////\x1b[38;5;247m*\x1b[38;5;246m//", " *\x1b[38;5;246m/\x1b[38;5;247m*\x1b[38;5;246m/\x1b[38;5;247m*\x1b[38;5;246m/\x1b[38;5;247m*\x1b[38;5;246m/\x1b[38;5;247m*\x1b[38;5;246m/\x1b[38;5;247m*\x1b[38;5;246m/\x1b[38;5;247m*\x1b[38;5;246m/\x1b[38;5;247m*\x1b[38;5;246m/\x1b[38;5;247m*\x1b[38;5;246m/\x1b[38;5;247m*\x1b[38;5;246m/\x1b[38;5;247m*\x1b[38;5;208m(((((/)))))\x1b[38;5;247m*\x1b[38;5;246m/\x1b[38;5;247m*\x1b[38;5;246m/\x1b[38;5;247m*\x1b[38;5;246m/\x1b[38;5;247m*\x1b[38;5;246m/\x1b[38;5;247m*\x1b[38;5;246m/\x1b[38;5;247m*\x1b[38;5;246m/\x1b[38;5;247m*\x1b[38;5;246m/\x1b[38;5;247m*\x1b[38;5;246m/\x1b[38;5;247m*\x1b[38;5;246m/\x1b[38;5;247m*\x1b[38;5;246m/\x1b[38;5;247m*", " \x1b[38;5;208m((((/))))", "", "", "", "\x1b[0m"]; for(var i=0;i{stack}

Please contact with developer/administrator at {contact}.", - 501: "The request requires use of a function, which isn't currently implemented by the server.", - 502: "The server had an error, while it was acting as a gateway.

Please contact with developer/administrator at {contact}.", - 503: "The service provided by the server is currently unavailable, possibly due to maintenance downtime or capacity problems. Please try again later.

Please contact with developer/administrator at {contact}.", - 504: "The server couldn't get response in time, while it was acting as a gateway.

Please contact with developer/administrator at {contact}.", - 505: "The server doesn't support HTTP version used in the request.", - 506: "Variant header is configured to be engaged in content negotiation.

Please contact with developer/administrator at {contact}.", - 507: "The server ran out of disk space neccessary to complete the request.", + 497: "You sent a non-TLS request to the HTTPS server.", + 500: "The server had an unexpected error. Below, the error stack is shown:

{stack}

You may need to contact the server administrator at {contact}.", + 501: "The request requires the use of a function, which isn't currently implemented by the server.", + 502: "The server had an error while it was acting as a gateway.

You may need to contact the server administrator at {contact}.", + 503: "The service provided by the server is currently unavailable, possibly due to maintenance downtime or capacity problems. Please try again later.

You may need to contact the server administrator at {contact}.", + 504: "The server couldn't get a response in time while it was acting as a gateway.

You may need to contact the server administrator at {contact}.", + 505: "The server doesn't support the HTTP version used in the request.", + 506: "The Variant header is configured to be engaged in content negotiation.

You may need to contact the server administrator at {contact}.", + 507: "The server ran out of disk space necessary to complete the request.", 508: "The server detected an infinite loop while processing the request.", - 509: "The server has it's bandwidth limit exceeded.

Please contact with developer/administrator at {contact}.", + 509: "The server has its bandwidth limit exceeded.

You may need to contact the server administrator at {contact}.", 510: "The server requires an extended HTTP request. The request you made isn't an extended HTTP request.", 511: "You need to authenticate yourself in order to get network access.", - 598: "The server couldn't get response in time, while it was acting as a proxy.", - 599: "The server couldn't connect in time, while it was acting as a proxy." + 598: "The server couldn't get a response in time while it was acting as a proxy.", + 599: "The server couldn't connect in time while it was acting as a proxy." }; // Create server @@ -2798,7 +2798,11 @@ if (!cluster.isPrimary) { delete table["connection"]; delete table["keep-alive"]; delete table["upgrade"]; - return res.writeHeadNodeApi(a, table); + if(res.stream && res.stream.destroyed) { + return false; + } else { + return res.writeHeadNodeApi(a, table); + } }; res.setHeader = function (a, b) { @@ -4590,6 +4594,7 @@ function bruteForceListenerWrapper(worker) { } var isWorkerHungUpBuff = true; +var isWorkerHungUpBuff2 = true; function msgListener(msg) { for (var i = 0; i < Object.keys(cluster.workers).length; i++) { @@ -4605,12 +4610,14 @@ function msgListener(msg) { // Do nothing! } else if (msg == "\x12KILLOK") { if(typeof isWorkerHungUpBuff != "undefined") isWorkerHungUpBuff = false; + } else if (msg == "\x12PINGOK") { + if(typeof isWorkerHungUpBuff2 != "undefined") isWorkerHungUpBuff2 = false; } else if (msg == "\x12KILLTERMMSG") { serverconsole.locmessage("Terminating unused worker process..."); } else if (msg == "\x12SAVEGOOD") { serverconsole.locmessage("Configuration saved."); } else if (msg.indexOf("\x12SAVEERR") == 0) { - serverconsole.locwarnmessage("There was a problem, while saving configuration file. Reason: " + msg.substr(8)); + serverconsole.locwarnmessage("There was a problem while saving configuration file. Reason: " + msg.substr(8)); } else if (msg == "\x12END") { cluster.workers[Object.keys(cluster.workers)[0]].on("message", function (msg) { if (msg.length >= 8 && msg.indexOf("\x12ERRLIST") == 0) { @@ -4981,21 +4988,55 @@ function start(init) { } else if (cluster.isPrimary) { setInterval(function () { var allClusters = Object.keys(cluster.workers); - for (var i = 0; i < allClusters.length; i++) { + var goodWorkers = []; + function checkWorker(callback, _id) { + if(typeof _id === "undefined") _id = 0; + if(_id >= allClusters.length) { + callback(); + return; + } try { - if (cluster.workers[allClusters[i]]) { - cluster.workers[allClusters[i]].on("message", msgListener); - cluster.workers[allClusters[i]].send("\x14SAVECONF"); + if (cluster.workers[allClusters[_id]]) { + isWorkerHungUpBuff2 = true; + cluster.workers[allClusters[_id]].on("message", msgListener); + cluster.workers[allClusters[_id]].send("\x14PINGPING"); + setTimeout(function () { + if (isWorkerHungUpBuff2) { + checkWorker(callback, _id+1); + } else { + goodWorkers.push(allClusters[_id]); + checkWorker(callback, _id+1); + } + }, 250); + } else { + checkWorker(callback, _id+1); } } catch (err) { - if (cluster.workers[allClusters[i]]) { - cluster.workers[allClusters[i]].removeAllListeners("message"); - cluster.workers[allClusters[i]].on("message", bruteForceListenerWrapper(cluster.workers[allClusters[i]])); - cluster.workers[allClusters[i]].on("message", listenConnListener); + if (cluster.workers[allClusters[_id]]) { + cluster.workers[allClusters[_id]].removeAllListeners("message"); + cluster.workers[allClusters[_id]].on("message", bruteForceListenerWrapper(cluster.workers[allClusters[_id]])); + cluster.workers[allClusters[_id]].on("message", listenConnListener); } - serverconsole.locwarnmessage("There was a problem, while saving configuration file. Reason: " + err.message); + checkWorker(callback, _id+1); } } + checkWorker(function () { + var wN = Math.floor(Math.random() * goodWorkers.length); //Send a configuration saving message to a random worker. + try { + if (cluster.workers[goodWorkers[wN]]) { + isWorkerHungUpBuff2 = true; + cluster.workers[goodWorkers[wN]].on("message", msgListener); + cluster.workers[goodWorkers[wN]].send("\x14SAVECONF"); + } + } catch (err) { + if (cluster.workers[goodWorkers[wN]]) { + cluster.workers[goodWorkers[wN]].removeAllListeners("message"); + cluster.workers[goodWorkers[wN]].on("message", bruteForceListenerWrapper(cluster.workers[goodWorkers[wN]])); + cluster.workers[goodWorkers[wN]].on("message", listenConnListener); + } + serverconsole.locwarnmessage("There was a problem while saving configuration file. Reason: " + err.message); + } + }); }, 300000); } if (!cluster.isPrimary) { @@ -5029,6 +5070,12 @@ function start(init) { process.send("\x12END"); } // Refuse to send, when it's really exiting. Main process will treat the worker as hung up anyway... + } else if (line == "\x14PINGPING") { + if(!reallyExiting) { + process.send("\x12PINGOK"); + process.send("\x12END"); + } + // Refuse to send, when it's really exiting. Main process will treat the worker as hung up anyway... } else if (line == "\x14KILLREQ") { if(reqcounter - reqcounterKillReq < 2) { process.send("\x12KILLTERMMSG"); @@ -5378,7 +5425,7 @@ function start(init) { cluster.workers[goodWorkers[wN]].on("message", bruteForceListenerWrapper(cluster.workers[goodWorkers[wN]])); cluster.workers[goodWorkers[wN]].on("message", listenConnListener); } - serverconsole.locwarnmessage("There was a problem, while terminating unused worker process. Reason: " + err.message); + serverconsole.locwarnmessage("There was a problem while terminating unused worker process. Reason: " + err.message); } } }); @@ -5472,7 +5519,7 @@ if (cluster.isPrimary || cluster.isPrimary === undefined) { saveConfig(); } } catch (err) { - serverconsole.locwarnmessage("There was a problem, while saving configuration file. Reason: " + err.message); + serverconsole.locwarnmessage("There was a problem while saving configuration file. Reason: " + err.message); } try { deleteFolderRecursive(__dirname + "/temp"); diff --git a/tests.html b/tests.html index 464052a..0a8e5ba 100644 --- a/tests.html +++ b/tests.html @@ -1,7 +1,7 @@ - SVR.JS 3.10.3 Tests + SVR.JS 3.11.0 Tests -

SVR.JS 3.10.3 Tests

+

SVR.JS 3.11.0 Tests

Directory

Directory (with query)