Skip to content

Commit

Permalink
set of updates:
Browse files Browse the repository at this point in the history
* [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 <[email protected]>
  • Loading branch information
r4sas committed Feb 18, 2022
1 parent bf3d7e7 commit a51ef0c
Show file tree
Hide file tree
Showing 16 changed files with 26 additions and 22 deletions.
2 changes: 1 addition & 1 deletion contrib/webconsole/style.css
Original file line number Diff line number Diff line change
@@ -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
*
Expand Down
18 changes: 11 additions & 7 deletions daemon/HTTPServer.cpp
Original file line number Diff line number Diff line change
@@ -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
*
Expand Down Expand Up @@ -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)
{
Expand Down Expand Up @@ -1427,15 +1433,13 @@ namespace http {
void HTTPServer::HandleAccept(const boost::system::error_code& ecode,
std::shared_ptr<boost::asio::ip::tcp::socket> 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 ();
}

Expand Down
2 changes: 1 addition & 1 deletion daemon/HTTPServerResources.h
Original file line number Diff line number Diff line change
@@ -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
*
Expand Down
2 changes: 1 addition & 1 deletion i18n/I18N.h
Original file line number Diff line number Diff line change
@@ -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
*
Expand Down
2 changes: 1 addition & 1 deletion i18n/Uzbek.cpp
Original file line number Diff line number Diff line change
@@ -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
*
Expand Down
2 changes: 1 addition & 1 deletion libi2pd/Destination.cpp
Original file line number Diff line number Diff line change
@@ -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
*
Expand Down
2 changes: 1 addition & 1 deletion libi2pd/I2PEndian.cpp
Original file line number Diff line number Diff line change
@@ -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
*
Expand Down
2 changes: 1 addition & 1 deletion libi2pd/I2PEndian.h
Original file line number Diff line number Diff line change
@@ -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
*
Expand Down
2 changes: 1 addition & 1 deletion libi2pd/Reseed.cpp
Original file line number Diff line number Diff line change
@@ -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
*
Expand Down
2 changes: 1 addition & 1 deletion libi2pd/SSU2.cpp
Original file line number Diff line number Diff line change
@@ -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
*
Expand Down
2 changes: 1 addition & 1 deletion libi2pd/SSU2.h
Original file line number Diff line number Diff line change
@@ -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
*
Expand Down
2 changes: 1 addition & 1 deletion libi2pd/util.cpp
Original file line number Diff line number Diff line change
@@ -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
*
Expand Down
2 changes: 1 addition & 1 deletion libi2pd/version.h
Original file line number Diff line number Diff line change
@@ -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
*
Expand Down
2 changes: 1 addition & 1 deletion libi2pd_wrapper/api.go
Original file line number Diff line number Diff line change
@@ -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
*
Expand Down
2 changes: 1 addition & 1 deletion libi2pd_wrapper/capi.cpp
Original file line number Diff line number Diff line change
@@ -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
*
Expand Down
2 changes: 1 addition & 1 deletion libi2pd_wrapper/capi.h
Original file line number Diff line number Diff line change
@@ -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
*
Expand Down

0 comments on commit a51ef0c

Please sign in to comment.