From a51ef0cfc6c836fa15758925770e08cc8e16e8d3 Mon Sep 17 00:00:00 2001 From: R4SAS Date: Fri, 18 Feb 2022 09:20:06 +0300 Subject: [PATCH] set of updates: * [webconsole] change error handling code to restart acceptor after any error * [webconsole] call shutdown vefore stopping acceptor on exit * update license headers for modified files, change year to file creation year, not 2013 (when project started) Signed-off-by: R4SAS --- contrib/webconsole/style.css | 2 +- daemon/HTTPServer.cpp | 18 +++++++++++------- daemon/HTTPServerResources.h | 2 +- i18n/I18N.h | 2 +- i18n/Uzbek.cpp | 2 +- libi2pd/Destination.cpp | 2 +- libi2pd/I2PEndian.cpp | 2 +- libi2pd/I2PEndian.h | 2 +- libi2pd/Reseed.cpp | 2 +- libi2pd/SSU2.cpp | 2 +- libi2pd/SSU2.h | 2 +- libi2pd/util.cpp | 2 +- libi2pd/version.h | 2 +- libi2pd_wrapper/api.go | 2 +- libi2pd_wrapper/capi.cpp | 2 +- libi2pd_wrapper/capi.h | 2 +- 16 files changed, 26 insertions(+), 22 deletions(-) diff --git a/contrib/webconsole/style.css b/contrib/webconsole/style.css index e6ddd6ad168..5d63d1a72e9 100644 --- a/contrib/webconsole/style.css +++ b/contrib/webconsole/style.css @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013-2021, The PurpleI2P Project + * Copyright (c) 2021-2022, The PurpleI2P Project * * This file is part of Purple i2pd project and licensed under BSD3 * diff --git a/daemon/HTTPServer.cpp b/daemon/HTTPServer.cpp index b3e48897d4a..fe2e7156f78 100644 --- a/daemon/HTTPServer.cpp +++ b/daemon/HTTPServer.cpp @@ -1,5 +1,5 @@ /* -* Copyright (c) 2013-2020, The PurpleI2P Project +* Copyright (c) 2013-2022, The PurpleI2P Project * * This file is part of Purple i2pd project and licensed under BSD3 * @@ -1391,7 +1391,13 @@ namespace http { void HTTPServer::Stop () { m_IsRunning = false; + + boost::system::error_code ec; + m_Acceptor.shutdown(boost::asio::ip::tcp::socket::shutdown_both, ec); + if (ec) + LogPrint (eLogDebug, "HTTPServer: Couldn't shutdown acceptor: ", ec.message ()); m_Acceptor.close(); + m_Service.stop (); if (m_Thread) { @@ -1427,15 +1433,13 @@ namespace http { void HTTPServer::HandleAccept(const boost::system::error_code& ecode, std::shared_ptr newSocket) { - if (ecode) + if (!ecode) + CreateConnection(newSocket); + else { if(newSocket) newSocket->close(); - LogPrint(eLogError, "HTTP Server: Error handling accept ", ecode.message()); - if(ecode != boost::asio::error::operation_aborted) - Accept(); - return; + LogPrint(eLogError, "HTTP Server: Error handling accept: ", ecode.message()); } - CreateConnection(newSocket); Accept (); } diff --git a/daemon/HTTPServerResources.h b/daemon/HTTPServerResources.h index 4e4eac4fe5e..0acbe8d18a8 100644 --- a/daemon/HTTPServerResources.h +++ b/daemon/HTTPServerResources.h @@ -1,5 +1,5 @@ /* -* Copyright (c) 2013-2021, The PurpleI2P Project +* Copyright (c) 2013-2022, The PurpleI2P Project * * This file is part of Purple i2pd project and licensed under BSD3 * diff --git a/i18n/I18N.h b/i18n/I18N.h index 5024fb56074..92238ee860a 100644 --- a/i18n/I18N.h +++ b/i18n/I18N.h @@ -1,5 +1,5 @@ /* -* Copyright (c) 2021, The PurpleI2P Project +* Copyright (c) 2022, The PurpleI2P Project * * This file is part of Purple i2pd project and licensed under BSD3 * diff --git a/i18n/Uzbek.cpp b/i18n/Uzbek.cpp index 4e151ac305c..e750918f2c9 100644 --- a/i18n/Uzbek.cpp +++ b/i18n/Uzbek.cpp @@ -1,5 +1,5 @@ /* -* Copyright (c) 2021, The PurpleI2P Project +* Copyright (c) 2021-2022, The PurpleI2P Project * * This file is part of Purple i2pd project and licensed under BSD3 * diff --git a/libi2pd/Destination.cpp b/libi2pd/Destination.cpp index 620961591c6..804b37f6fcc 100644 --- a/libi2pd/Destination.cpp +++ b/libi2pd/Destination.cpp @@ -1,5 +1,5 @@ /* -* Copyright (c) 2013-2021, The PurpleI2P Project +* Copyright (c) 2013-2022, The PurpleI2P Project * * This file is part of Purple i2pd project and licensed under BSD3 * diff --git a/libi2pd/I2PEndian.cpp b/libi2pd/I2PEndian.cpp index 57f7e70d94a..5496f14415c 100644 --- a/libi2pd/I2PEndian.cpp +++ b/libi2pd/I2PEndian.cpp @@ -1,5 +1,5 @@ /* -* Copyright (c) 2013-2020, The PurpleI2P Project +* Copyright (c) 2013-2022, The PurpleI2P Project * * This file is part of Purple i2pd project and licensed under BSD3 * diff --git a/libi2pd/I2PEndian.h b/libi2pd/I2PEndian.h index 696c1dc689f..d97bd05531b 100644 --- a/libi2pd/I2PEndian.h +++ b/libi2pd/I2PEndian.h @@ -1,5 +1,5 @@ /* -* Copyright (c) 2013-2020, The PurpleI2P Project +* Copyright (c) 2013-2022, The PurpleI2P Project * * This file is part of Purple i2pd project and licensed under BSD3 * diff --git a/libi2pd/Reseed.cpp b/libi2pd/Reseed.cpp index 890faa180b7..3fd3a27fc9f 100644 --- a/libi2pd/Reseed.cpp +++ b/libi2pd/Reseed.cpp @@ -1,5 +1,5 @@ /* -* Copyright (c) 2013-2021, The PurpleI2P Project +* Copyright (c) 2013-2022, The PurpleI2P Project * * This file is part of Purple i2pd project and licensed under BSD3 * diff --git a/libi2pd/SSU2.cpp b/libi2pd/SSU2.cpp index 52bba127952..68921340dfd 100644 --- a/libi2pd/SSU2.cpp +++ b/libi2pd/SSU2.cpp @@ -1,5 +1,5 @@ /* -* Copyright (c) 2013-2022, The PurpleI2P Project +* Copyright (c) 2022, The PurpleI2P Project * * This file is part of Purple i2pd project and licensed under BSD3 * diff --git a/libi2pd/SSU2.h b/libi2pd/SSU2.h index 7c1deefc32a..d720092617d 100644 --- a/libi2pd/SSU2.h +++ b/libi2pd/SSU2.h @@ -1,5 +1,5 @@ /* -* Copyright (c) 2013-2022, The PurpleI2P Project +* Copyright (c) 2022, The PurpleI2P Project * * This file is part of Purple i2pd project and licensed under BSD3 * diff --git a/libi2pd/util.cpp b/libi2pd/util.cpp index d548c9d4b97..f72885c2e62 100644 --- a/libi2pd/util.cpp +++ b/libi2pd/util.cpp @@ -1,5 +1,5 @@ /* -* Copyright (c) 2013-2020, The PurpleI2P Project +* Copyright (c) 2013-2022, The PurpleI2P Project * * This file is part of Purple i2pd project and licensed under BSD3 * diff --git a/libi2pd/version.h b/libi2pd/version.h index f315bd35cad..09e3c0601ff 100644 --- a/libi2pd/version.h +++ b/libi2pd/version.h @@ -1,5 +1,5 @@ /* -* Copyright (c) 2013-2021, The PurpleI2P Project +* Copyright (c) 2013-2022, The PurpleI2P Project * * This file is part of Purple i2pd project and licensed under BSD3 * diff --git a/libi2pd_wrapper/api.go b/libi2pd_wrapper/api.go index 00fb854a688..8c215f1331a 100644 --- a/libi2pd_wrapper/api.go +++ b/libi2pd_wrapper/api.go @@ -1,7 +1,7 @@ package api /* -* Copyright (c) 2013-2020, The PurpleI2P Project +* Copyright (c) 2021-2022, The PurpleI2P Project * * This file is part of Purple i2pd project and licensed under BSD3 * diff --git a/libi2pd_wrapper/capi.cpp b/libi2pd_wrapper/capi.cpp index d4ef3f1777b..af4765da146 100644 --- a/libi2pd_wrapper/capi.cpp +++ b/libi2pd_wrapper/capi.cpp @@ -1,5 +1,5 @@ /* -* Copyright (c) 2013-2020, The PurpleI2P Project +* Copyright (c) 2021-2022, The PurpleI2P Project * * This file is part of Purple i2pd project and licensed under BSD3 * diff --git a/libi2pd_wrapper/capi.h b/libi2pd_wrapper/capi.h index 92afb19eaa0..aefd89f37a6 100644 --- a/libi2pd_wrapper/capi.h +++ b/libi2pd_wrapper/capi.h @@ -1,5 +1,5 @@ /* -* Copyright (c) 2013-2020, The PurpleI2P Project +* Copyright (c) 2021-2022, The PurpleI2P Project * * This file is part of Purple i2pd project and licensed under BSD3 *