mirror of
https://github.com/twisterarmy/twister-core.git
synced 2025-02-02 18:04:23 +00:00
Show error message instead of exception crash when unable to bind RPC port
Fixes issue #875
This commit is contained in:
parent
399ff1fe05
commit
3e34352222
@ -2377,9 +2377,21 @@ void ThreadRPCServer2(void* parg)
|
|||||||
|
|
||||||
asio::io_service io_service;
|
asio::io_service io_service;
|
||||||
ip::tcp::endpoint endpoint(bindAddress, GetArg("-rpcport", 8332));
|
ip::tcp::endpoint endpoint(bindAddress, GetArg("-rpcport", 8332));
|
||||||
ip::tcp::acceptor acceptor(io_service, endpoint);
|
ip::tcp::acceptor acceptor(io_service);
|
||||||
|
try
|
||||||
acceptor.set_option(boost::asio::ip::tcp::acceptor::reuse_address(true));
|
{
|
||||||
|
acceptor.open(endpoint.protocol());
|
||||||
|
acceptor.set_option(boost::asio::ip::tcp::acceptor::reuse_address(true));
|
||||||
|
acceptor.bind(endpoint);
|
||||||
|
acceptor.listen(socket_base::max_connections);
|
||||||
|
}
|
||||||
|
catch(system::system_error &e)
|
||||||
|
{
|
||||||
|
ThreadSafeMessageBox(strprintf(_("An error occured while setting up the RPC port %i for listening: %s"), endpoint.port(), e.what()),
|
||||||
|
_("Error"), wxOK | wxMODAL);
|
||||||
|
QueueShutdown();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
ssl::context context(io_service, ssl::context::sslv23);
|
ssl::context context(io_service, ssl::context::sslv23);
|
||||||
if (fUseSSL)
|
if (fUseSSL)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user