|
|
@ -40,6 +40,11 @@ const Object emptyobj; |
|
|
|
|
|
|
|
|
|
|
|
void ThreadRPCServer3(void* parg); |
|
|
|
void ThreadRPCServer3(void* parg); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static inline unsigned short GetDefaultRPCPort() |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
return GetBoolArg("-testnet", false) ? 18332 : 8332; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
Object JSONRPCError(int code, const string& message) |
|
|
|
Object JSONRPCError(int code, const string& message) |
|
|
|
{ |
|
|
|
{ |
|
|
|
Object error; |
|
|
|
Object error; |
|
|
@ -760,7 +765,7 @@ void ThreadRPCServer2(void* parg) |
|
|
|
// Try a dual IPv6/IPv4 socket, falling back to separate IPv4 and IPv6 sockets
|
|
|
|
// Try a dual IPv6/IPv4 socket, falling back to separate IPv4 and IPv6 sockets
|
|
|
|
const bool loopback = !mapArgs.count("-rpcallowip"); |
|
|
|
const bool loopback = !mapArgs.count("-rpcallowip"); |
|
|
|
asio::ip::address bindAddress = loopback ? asio::ip::address_v6::loopback() : asio::ip::address_v6::any(); |
|
|
|
asio::ip::address bindAddress = loopback ? asio::ip::address_v6::loopback() : asio::ip::address_v6::any(); |
|
|
|
ip::tcp::endpoint endpoint(bindAddress, GetArg("-rpcport", 8332)); |
|
|
|
ip::tcp::endpoint endpoint(bindAddress, GetArg("-rpcport", GetDefaultRPCPort())); |
|
|
|
boost::system::error_code v6_only_error; |
|
|
|
boost::system::error_code v6_only_error; |
|
|
|
boost::shared_ptr<ip::tcp::acceptor> acceptor(new ip::tcp::acceptor(io_service)); |
|
|
|
boost::shared_ptr<ip::tcp::acceptor> acceptor(new ip::tcp::acceptor(io_service)); |
|
|
|
|
|
|
|
|
|
|
@ -1055,7 +1060,7 @@ Object CallRPC(const string& strMethod, const Array& params) |
|
|
|
asio::ssl::stream<asio::ip::tcp::socket> sslStream(io_service, context); |
|
|
|
asio::ssl::stream<asio::ip::tcp::socket> sslStream(io_service, context); |
|
|
|
SSLIOStreamDevice<asio::ip::tcp> d(sslStream, fUseSSL); |
|
|
|
SSLIOStreamDevice<asio::ip::tcp> d(sslStream, fUseSSL); |
|
|
|
iostreams::stream< SSLIOStreamDevice<asio::ip::tcp> > stream(d); |
|
|
|
iostreams::stream< SSLIOStreamDevice<asio::ip::tcp> > stream(d); |
|
|
|
if (!d.connect(GetArg("-rpcconnect", "127.0.0.1"), GetArg("-rpcport", "8332"))) |
|
|
|
if (!d.connect(GetArg("-rpcconnect", "127.0.0.1"), GetArg("-rpcport", itostr(GetDefaultRPCPort())))) |
|
|
|
throw runtime_error("couldn't connect to server"); |
|
|
|
throw runtime_error("couldn't connect to server"); |
|
|
|
|
|
|
|
|
|
|
|
// HTTP basic authentication
|
|
|
|
// HTTP basic authentication
|
|
|
|