diff options
author | Jeff Garzik <jgarzik@exmulti.com> | 2012-06-28 23:18:38 -0400 |
---|---|---|
committer | Jeff Garzik <jgarzik@redhat.com> | 2012-06-28 23:18:38 -0400 |
commit | 70ab73a0087cbb0d6b26c9ad58146ae542b1b9be (patch) | |
tree | 4b65de10c0606f765d4c1b99bfcb3a2825f7dc0c | |
parent | 5fa83965f22ae92f86de74104b621c2168d37698 (diff) |
Create new rpcnet module, and move 'getconnectioncount' RPC to it
-rw-r--r-- | bitcoin-qt.pro | 1 | ||||
-rw-r--r-- | src/bitcoinrpc.cpp | 12 | ||||
-rw-r--r-- | src/makefile.linux-mingw | 1 | ||||
-rw-r--r-- | src/makefile.mingw | 1 | ||||
-rw-r--r-- | src/makefile.osx | 1 | ||||
-rw-r--r-- | src/makefile.unix | 1 | ||||
-rw-r--r-- | src/rpcnet.cpp | 21 |
7 files changed, 27 insertions, 11 deletions
diff --git a/bitcoin-qt.pro b/bitcoin-qt.pro index b293bad949..6bfeeff072 100644 --- a/bitcoin-qt.pro +++ b/bitcoin-qt.pro @@ -206,6 +206,7 @@ SOURCES += src/qt/bitcoin.cpp src/qt/bitcoingui.cpp \ src/qt/walletmodel.cpp \ src/bitcoinrpc.cpp \ src/rpcdump.cpp \ + src/rpcnet.cpp \ src/qt/overviewpage.cpp \ src/qt/csvmodelwriter.cpp \ src/crypter.cpp \ diff --git a/src/bitcoinrpc.cpp b/src/bitcoinrpc.cpp index de6db53982..3c61121dab 100644 --- a/src/bitcoinrpc.cpp +++ b/src/bitcoinrpc.cpp @@ -46,6 +46,7 @@ static std::string strRPCUserColonPass; static int64 nWalletUnlockTime; static CCriticalSection cs_nWalletUnlockTime; +extern Value getconnectioncount(const Array& params, bool fHelp); extern Value dumpprivkey(const Array& params, bool fHelp); extern Value importprivkey(const Array& params, bool fHelp); @@ -456,17 +457,6 @@ Value getblockcount(const Array& params, bool fHelp) } -Value getconnectioncount(const Array& params, bool fHelp) -{ - if (fHelp || params.size() != 0) - throw runtime_error( - "getconnectioncount\n" - "Returns the number of connections to other nodes."); - - return (int)vNodes.size(); -} - - Value getdifficulty(const Array& params, bool fHelp) { if (fHelp || params.size() != 0) diff --git a/src/makefile.linux-mingw b/src/makefile.linux-mingw index cd8e97080c..5afb5c78a1 100644 --- a/src/makefile.linux-mingw +++ b/src/makefile.linux-mingw @@ -60,6 +60,7 @@ OBJS= \ obj/protocol.o \ obj/bitcoinrpc.o \ obj/rpcdump.o \ + obj/rpcnet.o \ obj/script.o \ obj/sync.o \ obj/util.o \ diff --git a/src/makefile.mingw b/src/makefile.mingw index 919be007b6..907a15a3f1 100644 --- a/src/makefile.mingw +++ b/src/makefile.mingw @@ -57,6 +57,7 @@ OBJS= \ obj/protocol.o \ obj/bitcoinrpc.o \ obj/rpcdump.o \ + obj/rpcnet.o \ obj/script.o \ obj/sync.o \ obj/util.o \ diff --git a/src/makefile.osx b/src/makefile.osx index 9728733122..cbb269cef1 100644 --- a/src/makefile.osx +++ b/src/makefile.osx @@ -84,6 +84,7 @@ OBJS= \ obj/protocol.o \ obj/bitcoinrpc.o \ obj/rpcdump.o \ + obj/rpcnet.o \ obj/script.o \ obj/sync.o \ obj/util.o \ diff --git a/src/makefile.unix b/src/makefile.unix index 9052891b4f..420c7ac3fa 100644 --- a/src/makefile.unix +++ b/src/makefile.unix @@ -104,6 +104,7 @@ OBJS= \ obj/protocol.o \ obj/bitcoinrpc.o \ obj/rpcdump.o \ + obj/rpcnet.o \ obj/script.o \ obj/sync.o \ obj/util.o \ diff --git a/src/rpcnet.cpp b/src/rpcnet.cpp new file mode 100644 index 0000000000..1c27d0ef8c --- /dev/null +++ b/src/rpcnet.cpp @@ -0,0 +1,21 @@ +// Copyright (c) 2009-2012 Bitcoin Developers +// Distributed under the MIT/X11 software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. + +#include "net.h" +#include "bitcoinrpc.h" + +using namespace json_spirit; +using namespace std; + +Value getconnectioncount(const Array& params, bool fHelp) +{ + if (fHelp || params.size() != 0) + throw runtime_error( + "getconnectioncount\n" + "Returns the number of connections to other nodes."); + + return (int)vNodes.size(); +} + + |