diff options
author | Wladimir J. van der Laan <laanwj@gmail.com> | 2015-09-22 17:53:25 +0200 |
---|---|---|
committer | Wladimir J. van der Laan <laanwj@gmail.com> | 2015-09-22 18:06:57 +0200 |
commit | 743cc9e08bf726837d3de5a82a3f497fac42858a (patch) | |
tree | ef8a31959bb2182aae4321c33c6b0fc4c12558dc /src | |
parent | f696ea12e18b9f9e1518a59f3ad36ba887f4f31a (diff) | |
parent | 5e6d8936505da29d60b88eed7fd9aa6abdae5d92 (diff) |
Merge pull request #6704
5e6d893 travis: for travis generating an extra build (Cory Fields)
ceba0f8 PARTIAL: typofixes (found by misspell_fixer) (Veres Lajos)
2ede6b7 add support for miniupnpc api version 14 (Pavel Vasin)
0dfcdd4 rpc-tests: re-enable rpc-tests for Windows (Cory Fields)
c9ad65e net: Set SO_REUSEADDR for Windows too (Cory Fields)
0194bdd add unit test for CNetAddr::GetGroup. (Alex Morcos)
bdf2542 Fix masking of irrelevant bits in address groups. (Alex Morcos)
65426ac Add missing files to files.md (fanquake)
28d76d2 Handle leveldb::DestroyDB() errors on wipe failure (Adam Weiss)
843469e Use unique name for AlertNotify tempfile (Casey Rodarmor)
4e5ea71 Make sure LogPrint strings are line-terminated (J Ross Nicoll)
3861f0f build: fix libressl detection (Cory Fields)
04507de Avoid leaking file descriptors in RegisterLoad (Casey Rodarmor)
8b59079 Add autogen.sh to source tarball. (randy-waterhouse)
Diffstat (limited to 'src')
-rw-r--r-- | src/addrman.h | 2 | ||||
-rw-r--r-- | src/bitcoin-tx.cpp | 7 | ||||
-rw-r--r-- | src/leveldbwrapper.cpp | 3 | ||||
-rw-r--r-- | src/main.cpp | 2 | ||||
-rw-r--r-- | src/merkleblock.cpp | 2 | ||||
-rw-r--r-- | src/net.cpp | 12 | ||||
-rw-r--r-- | src/netbase.cpp | 2 | ||||
-rw-r--r-- | src/qt/paymentserver.cpp | 2 | ||||
-rw-r--r-- | src/qt/rpcconsole.cpp | 2 | ||||
-rw-r--r-- | src/rpcserver.cpp | 2 | ||||
-rw-r--r-- | src/rpcwallet.cpp | 2 | ||||
-rw-r--r-- | src/sync.h | 2 | ||||
-rw-r--r-- | src/test/alert_tests.cpp | 4 | ||||
-rw-r--r-- | src/test/netbase_tests.cpp | 17 |
14 files changed, 43 insertions, 18 deletions
diff --git a/src/addrman.h b/src/addrman.h index fdc4d02c38..ea63679307 100644 --- a/src/addrman.h +++ b/src/addrman.h @@ -265,7 +265,7 @@ public: * Notice that vvTried, mapAddr and vVector are never encoded explicitly; * they are instead reconstructed from the other information. * - * vvNew is serialized, but only used if ADDRMAN_UNKOWN_BUCKET_COUNT didn't change, + * vvNew is serialized, but only used if ADDRMAN_UNKNOWN_BUCKET_COUNT didn't change, * otherwise it is reconstructed as well. * * This format is more complex, but significantly smaller (at most 1.5 MiB), and supports diff --git a/src/bitcoin-tx.cpp b/src/bitcoin-tx.cpp index c1be1229d3..3aa2211f97 100644 --- a/src/bitcoin-tx.cpp +++ b/src/bitcoin-tx.cpp @@ -149,13 +149,14 @@ static void RegisterLoad(const string& strInput) valStr.insert(valStr.size(), buf, bread); } - if (ferror(f)) { + int error = ferror(f); + fclose(f); + + if (error) { string strErr = "Error reading file " + filename; throw runtime_error(strErr); } - fclose(f); - // evaluate as JSON buffer register RegisterSetJson(key, valStr); } diff --git a/src/leveldbwrapper.cpp b/src/leveldbwrapper.cpp index 70980fede5..1f674a91df 100644 --- a/src/leveldbwrapper.cpp +++ b/src/leveldbwrapper.cpp @@ -58,7 +58,8 @@ CLevelDBWrapper::CLevelDBWrapper(const boost::filesystem::path& path, size_t nCa } else { if (fWipe) { LogPrintf("Wiping LevelDB in %s\n", path.string()); - leveldb::DestroyDB(path.string(), options); + leveldb::Status result = leveldb::DestroyDB(path.string(), options); + HandleError(result); } TryCreateDirectory(path); LogPrintf("Opening LevelDB in %s\n", path.string()); diff --git a/src/main.cpp b/src/main.cpp index 4d287eec92..ce87aef68f 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -2797,7 +2797,7 @@ bool AbortNode(const std::string &strMessage, const std::string &userMessage) { strMiscWarning = strMessage; LogPrintf("*** %s\n", strMessage); uiInterface.ThreadSafeMessageBox( - userMessage.empty() ? _("Error: A fatal internal error occured, see debug.log for details") : userMessage, + userMessage.empty() ? _("Error: A fatal internal error occurred, see debug.log for details") : userMessage, "", CClientUIInterface::MSG_ERROR); StartShutdown(); return false; diff --git a/src/merkleblock.cpp b/src/merkleblock.cpp index 8618e355d7..0af5c6839e 100644 --- a/src/merkleblock.cpp +++ b/src/merkleblock.cpp @@ -139,7 +139,7 @@ uint256 CPartialMerkleTree::ExtractMatches(std::vector<uint256> &vMatch) { // traverse the partial tree unsigned int nBitsUsed = 0, nHashUsed = 0; uint256 hashMerkleRoot = TraverseAndExtract(nHeight, 0, nBitsUsed, nHashUsed, vMatch); - // verify that no problems occured during the tree traversal + // verify that no problems occurred during the tree traversal if (fBad) return 0; // verify that all bits were consumed (except for the padding caused by serializing it as a byte sequence) diff --git a/src/net.cpp b/src/net.cpp index 6eb2020b33..375c00308c 100644 --- a/src/net.cpp +++ b/src/net.cpp @@ -581,7 +581,7 @@ bool CNode::ReceiveMsgBytes(const char *pch, unsigned int nBytes) return false; if (msg.in_data && msg.hdr.nMessageSize > MAX_PROTOCOL_MESSAGE_LENGTH) { - LogPrint("net", "Oversized message from peer=%i, disconnecting", GetId()); + LogPrint("net", "Oversized message from peer=%i, disconnecting\n", GetId()); return false; } @@ -1032,10 +1032,14 @@ void ThreadMapPort() #ifndef UPNPDISCOVER_SUCCESS /* miniupnpc 1.5 */ devlist = upnpDiscover(2000, multicastif, minissdpdpath, 0); -#else +#elif MINIUPNPC_API_VERSION < 14 /* miniupnpc 1.6 */ int error = 0; devlist = upnpDiscover(2000, multicastif, minissdpdpath, 0, 0, &error); +#else + /* miniupnpc 1.9.20150730 */ + int error = 0; + devlist = upnpDiscover(2000, multicastif, minissdpdpath, 0, 0, 2, &error); #endif struct UPNPUrls urls; @@ -1524,8 +1528,10 @@ bool BindListenPort(const CService &addrBind, string& strError, bool fWhiteliste setsockopt(hListenSocket, SOL_SOCKET, SO_NOSIGPIPE, (void*)&nOne, sizeof(int)); #endif // Allow binding if the port is still in TIME_WAIT state after - // the program was closed and restarted. Not an issue on windows! + // the program was closed and restarted. setsockopt(hListenSocket, SOL_SOCKET, SO_REUSEADDR, (void*)&nOne, sizeof(int)); +#else + setsockopt(hListenSocket, SOL_SOCKET, SO_REUSEADDR, (const char*)&nOne, sizeof(int)); #endif // Set to non-blocking, incoming connections will also inherit this diff --git a/src/netbase.cpp b/src/netbase.cpp index 7f20cd05ec..ca864104c0 100644 --- a/src/netbase.cpp +++ b/src/netbase.cpp @@ -947,7 +947,7 @@ std::vector<unsigned char> CNetAddr::GetGroup() const nBits -= 8; } if (nBits > 0) - vchRet.push_back(GetByte(15 - nStartByte) | ((1 << nBits) - 1)); + vchRet.push_back(GetByte(15 - nStartByte) | ((1 << (8 - nBits)) - 1)); return vchRet; } diff --git a/src/qt/paymentserver.cpp b/src/qt/paymentserver.cpp index 0f8f6f0ce8..8a39beb1f5 100644 --- a/src/qt/paymentserver.cpp +++ b/src/qt/paymentserver.cpp @@ -743,6 +743,6 @@ void PaymentServer::setOptionsModel(OptionsModel *optionsModel) void PaymentServer::handlePaymentACK(const QString& paymentACKMsg) { - // currently we don't futher process or store the paymentACK message + // currently we don't further process or store the paymentACK message emit message(tr("Payment acknowledged"), paymentACKMsg, CClientUIInterface::ICON_INFORMATION | CClientUIInterface::MODAL); } diff --git a/src/qt/rpcconsole.cpp b/src/qt/rpcconsole.cpp index 2d2d448b49..1d7f10b49b 100644 --- a/src/qt/rpcconsole.cpp +++ b/src/qt/rpcconsole.cpp @@ -556,7 +556,7 @@ void RPCConsole::peerLayoutChanged() if (detailNodeRow < 0) { - // detail node dissapeared from table (node disconnected) + // detail node disappeared from table (node disconnected) fUnselect = true; cachedNodeid = -1; ui->detailWidget->hide(); diff --git a/src/rpcserver.cpp b/src/rpcserver.cpp index 37e4f48a3d..41fc274eef 100644 --- a/src/rpcserver.cpp +++ b/src/rpcserver.cpp @@ -644,7 +644,7 @@ void StartRPCThreads() vEndpoints.push_back(ip::tcp::endpoint(asio::ip::address_v6::any(), defaultPort)); vEndpoints.push_back(ip::tcp::endpoint(asio::ip::address_v4::any(), defaultPort)); // Prefer making the socket dual IPv6/IPv4 instead of binding - // to both addresses seperately. + // to both addresses separately. bBindAny = true; } diff --git a/src/rpcwallet.cpp b/src/rpcwallet.cpp index ace6746311..f9839546ec 100644 --- a/src/rpcwallet.cpp +++ b/src/rpcwallet.cpp @@ -719,7 +719,7 @@ Value movecmd(const Array& params, bool fHelp) "3. minconf (numeric, optional, default=1) Only use funds with at least this many confirmations.\n" "4. \"comment\" (string, optional) An optional comment, stored in the wallet only.\n" "\nResult:\n" - "true|false (boolean) true if successfull.\n" + "true|false (boolean) true if successful.\n" "\nExamples:\n" "\nMove 0.01 btc from the default account to the account named tabby\n" + HelpExampleCli("move", "\"\" \"tabby\" 0.01") + diff --git a/src/sync.h b/src/sync.h index cd0aa7b20e..93d72f84a4 100644 --- a/src/sync.h +++ b/src/sync.h @@ -16,7 +16,7 @@ //////////////////////////////////////////////// // // -// THE SIMPLE DEFINITON, EXCLUDING DEBUG CODE // +// THE SIMPLE DEFINITION, EXCLUDING DEBUG CODE // // // //////////////////////////////////////////////// diff --git a/src/test/alert_tests.cpp b/src/test/alert_tests.cpp index 4869ba52ac..2febbcd757 100644 --- a/src/test/alert_tests.cpp +++ b/src/test/alert_tests.cpp @@ -158,8 +158,8 @@ BOOST_AUTO_TEST_CASE(AlertNotify) { SetMockTime(11); - boost::filesystem::path temp = GetTempPath() / "alertnotify.txt"; - boost::filesystem::remove(temp); + boost::filesystem::path temp = GetTempPath() / + boost::filesystem::unique_path("alertnotify-%%%%.txt"); mapArgs["-alertnotify"] = std::string("echo %s >> ") + temp.string(); diff --git a/src/test/netbase_tests.cpp b/src/test/netbase_tests.cpp index d5188c3acc..67593b6435 100644 --- a/src/test/netbase_tests.cpp +++ b/src/test/netbase_tests.cpp @@ -6,6 +6,7 @@ #include <string> +#include <boost/assign/list_of.hpp> #include <boost/test/unit_test.hpp> using namespace std; @@ -144,4 +145,20 @@ BOOST_AUTO_TEST_CASE(subnet_test) BOOST_CHECK(!CSubNet("fuzzy").IsValid()); } +BOOST_AUTO_TEST_CASE(netbase_getgroup) +{ + BOOST_CHECK(CNetAddr("127.0.0.1").GetGroup() == boost::assign::list_of(0)); // Local -> !Routable() + BOOST_CHECK(CNetAddr("257.0.0.1").GetGroup() == boost::assign::list_of(0)); // !Valid -> !Routable() + BOOST_CHECK(CNetAddr("10.0.0.1").GetGroup() == boost::assign::list_of(0)); // RFC1918 -> !Routable() + BOOST_CHECK(CNetAddr("169.254.1.1").GetGroup() == boost::assign::list_of(0)); // RFC3927 -> !Routable() + BOOST_CHECK(CNetAddr("1.2.3.4").GetGroup() == boost::assign::list_of((unsigned char)NET_IPV4)(1)(2)); // IPv4 + BOOST_CHECK(CNetAddr("::FFFF:0:102:304").GetGroup() == boost::assign::list_of((unsigned char)NET_IPV4)(1)(2)); // RFC6145 + BOOST_CHECK(CNetAddr("64:FF9B::102:304").GetGroup() == boost::assign::list_of((unsigned char)NET_IPV4)(1)(2)); // RFC6052 + BOOST_CHECK(CNetAddr("2002:102:304:9999:9999:9999:9999:9999").GetGroup() == boost::assign::list_of((unsigned char)NET_IPV4)(1)(2)); // RFC3964 + BOOST_CHECK(CNetAddr("2001:0:9999:9999:9999:9999:FEFD:FCFB").GetGroup() == boost::assign::list_of((unsigned char)NET_IPV4)(1)(2)); // RFC4380 + BOOST_CHECK(CNetAddr("FD87:D87E:EB43:edb1:8e4:3588:e546:35ca").GetGroup() == boost::assign::list_of((unsigned char)NET_TOR)(239)); // Tor + BOOST_CHECK(CNetAddr("2001:470:abcd:9999:9999:9999:9999:9999").GetGroup() == boost::assign::list_of((unsigned char)NET_IPV6)(32)(1)(4)(112)(175)); //he.net + BOOST_CHECK(CNetAddr("2001:2001:9999:9999:9999:9999:9999:9999").GetGroup() == boost::assign::list_of((unsigned char)NET_IPV6)(32)(1)(32)(1)); //IPv6 +} + BOOST_AUTO_TEST_SUITE_END() |