aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/allocators.h165
-rw-r--r--src/checkpoints.cpp2
-rw-r--r--src/crypter.cpp12
-rw-r--r--src/crypter.h11
-rw-r--r--src/main.cpp52
-rw-r--r--src/main.h2
-rw-r--r--src/makefile.linux-mingw5
-rw-r--r--src/makefile.mingw13
-rw-r--r--src/net.cpp4
-rw-r--r--src/qt/bitcoin.cpp53
-rw-r--r--src/qt/bitcoingui.cpp10
-rw-r--r--src/qt/locale/bitcoin_cs.ts186
-rw-r--r--src/qt/qtipcserver.cpp54
-rw-r--r--src/qt/qtipcserver.h3
-rw-r--r--src/test/allocator_tests.cpp115
-rw-r--r--src/util.cpp2
-rw-r--r--src/version.h4
17 files changed, 497 insertions, 196 deletions
diff --git a/src/allocators.h b/src/allocators.h
index ddeabc48c5..99afa10c25 100644
--- a/src/allocators.h
+++ b/src/allocators.h
@@ -7,6 +7,8 @@
#include <string.h>
#include <string>
+#include <boost/thread/mutex.hpp>
+#include <map>
#ifdef WIN32
#ifdef _WIN32_WINNT
@@ -22,23 +24,156 @@
// Note that VirtualLock does not provide this as a guarantee on Windows,
// but, in practice, memory that has been VirtualLock'd almost never gets written to
// the pagefile except in rare circumstances where memory is extremely low.
-#define mlock(p, n) VirtualLock((p), (n));
-#define munlock(p, n) VirtualUnlock((p), (n));
#else
#include <sys/mman.h>
-#include <limits.h>
-/* This comes from limits.h if it's not defined there set a sane default */
-#ifndef PAGESIZE
-#include <unistd.h>
-#define PAGESIZE sysconf(_SC_PAGESIZE)
+#include <limits.h> // for PAGESIZE
+#include <unistd.h> // for sysconf
#endif
-#define mlock(a,b) \
- mlock(((void *)(((size_t)(a)) & (~((PAGESIZE)-1)))),\
- (((((size_t)(a)) + (b) - 1) | ((PAGESIZE) - 1)) + 1) - (((size_t)(a)) & (~((PAGESIZE) - 1))))
-#define munlock(a,b) \
- munlock(((void *)(((size_t)(a)) & (~((PAGESIZE)-1)))),\
- (((((size_t)(a)) + (b) - 1) | ((PAGESIZE) - 1)) + 1) - (((size_t)(a)) & (~((PAGESIZE) - 1))))
+
+/**
+ * Thread-safe class to keep track of locked (ie, non-swappable) memory pages.
+ *
+ * Memory locks do not stack, that is, pages which have been locked several times by calls to mlock()
+ * will be unlocked by a single call to munlock(). This can result in keying material ending up in swap when
+ * those functions are used naively. This class simulates stacking memory locks by keeping a counter per page.
+ *
+ * @note By using a map from each page base address to lock count, this class is optimized for
+ * small objects that span up to a few pages, mostly smaller than a page. To support large allocations,
+ * something like an interval tree would be the preferred data structure.
+ */
+template <class Locker> class LockedPageManagerBase
+{
+public:
+ LockedPageManagerBase(size_t page_size):
+ page_size(page_size)
+ {
+ // Determine bitmask for extracting page from address
+ assert(!(page_size & (page_size-1))); // size must be power of two
+ page_mask = ~(page_size - 1);
+ }
+
+ // For all pages in affected range, increase lock count
+ void LockRange(void *p, size_t size)
+ {
+ boost::mutex::scoped_lock lock(mutex);
+ if(!size) return;
+ const size_t base_addr = reinterpret_cast<size_t>(p);
+ const size_t start_page = base_addr & page_mask;
+ const size_t end_page = (base_addr + size - 1) & page_mask;
+ for(size_t page = start_page; page <= end_page; page += page_size)
+ {
+ Histogram::iterator it = histogram.find(page);
+ if(it == histogram.end()) // Newly locked page
+ {
+ locker.Lock(reinterpret_cast<void*>(page), page_size);
+ histogram.insert(std::make_pair(page, 1));
+ }
+ else // Page was already locked; increase counter
+ {
+ it->second += 1;
+ }
+ }
+ }
+
+ // For all pages in affected range, decrease lock count
+ void UnlockRange(void *p, size_t size)
+ {
+ boost::mutex::scoped_lock lock(mutex);
+ if(!size) return;
+ const size_t base_addr = reinterpret_cast<size_t>(p);
+ const size_t start_page = base_addr & page_mask;
+ const size_t end_page = (base_addr + size - 1) & page_mask;
+ for(size_t page = start_page; page <= end_page; page += page_size)
+ {
+ Histogram::iterator it = histogram.find(page);
+ assert(it != histogram.end()); // Cannot unlock an area that was not locked
+ // Decrease counter for page, when it is zero, the page will be unlocked
+ it->second -= 1;
+ if(it->second == 0) // Nothing on the page anymore that keeps it locked
+ {
+ // Unlock page and remove the count from histogram
+ locker.Unlock(reinterpret_cast<void*>(page), page_size);
+ histogram.erase(it);
+ }
+ }
+ }
+
+ // Get number of locked pages for diagnostics
+ int GetLockedPageCount()
+ {
+ boost::mutex::scoped_lock lock(mutex);
+ return histogram.size();
+ }
+
+private:
+ Locker locker;
+ boost::mutex mutex;
+ size_t page_size, page_mask;
+ // map of page base address to lock count
+ typedef std::map<size_t,int> Histogram;
+ Histogram histogram;
+};
+
+/** Determine system page size in bytes */
+static inline size_t GetSystemPageSize()
+{
+ size_t page_size;
+#if defined(WIN32)
+ SYSTEM_INFO sSysInfo;
+ GetSystemInfo(&sSysInfo);
+ page_size = sSysInfo.dwPageSize;
+#elif defined(PAGESIZE) // defined in limits.h
+ page_size = PAGESIZE;
+#else // assume some POSIX OS
+ page_size = sysconf(_SC_PAGESIZE);
+#endif
+ return page_size;
+}
+
+/**
+ * OS-dependent memory page locking/unlocking.
+ * Defined as policy class to make stubbing for test possible.
+ */
+class MemoryPageLocker
+{
+public:
+ /** Lock memory pages.
+ * addr and len must be a multiple of the system page size
+ */
+ bool Lock(const void *addr, size_t len)
+ {
+#ifdef WIN32
+ return VirtualLock(const_cast<void*>(addr), len);
+#else
+ return mlock(addr, len) == 0;
+#endif
+ }
+ /** Unlock memory pages.
+ * addr and len must be a multiple of the system page size
+ */
+ bool Unlock(const void *addr, size_t len)
+ {
+#ifdef WIN32
+ return VirtualUnlock(const_cast<void*>(addr), len);
+#else
+ return munlock(addr, len) == 0;
#endif
+ }
+};
+
+/**
+ * Singleton class to keep track of locked (ie, non-swappable) memory pages, for use in
+ * std::allocator templates.
+ */
+class LockedPageManager: public LockedPageManagerBase<MemoryPageLocker>
+{
+public:
+ static LockedPageManager instance; // instantiated in util.cpp
+private:
+ LockedPageManager():
+ LockedPageManagerBase<MemoryPageLocker>(GetSystemPageSize())
+ {}
+};
//
// Allocator that locks its contents from being paged
@@ -69,7 +204,7 @@ struct secure_allocator : public std::allocator<T>
T *p;
p = std::allocator<T>::allocate(n, hint);
if (p != NULL)
- mlock(p, sizeof(T) * n);
+ LockedPageManager::instance.LockRange(p, sizeof(T) * n);
return p;
}
@@ -78,7 +213,7 @@ struct secure_allocator : public std::allocator<T>
if (p != NULL)
{
memset(p, 0, sizeof(T) * n);
- munlock(p, sizeof(T) * n);
+ LockedPageManager::instance.UnlockRange(p, sizeof(T) * n);
}
std::allocator<T>::deallocate(p, n);
}
diff --git a/src/checkpoints.cpp b/src/checkpoints.cpp
index 2df647e83d..8208854962 100644
--- a/src/checkpoints.cpp
+++ b/src/checkpoints.cpp
@@ -29,7 +29,7 @@ namespace Checkpoints
(105000, uint256("0x00000000000291ce28027faea320c8d2b054b2e0fe44a773f3eefb151d6bdc97"))
(134444, uint256("0x00000000000005b12ffd4cd315cd34ffd4a594f430ac814c91184a0d42d2b0fe"))
(168000, uint256("0x000000000000099e61ea72015e79632f216fe6cb33d7899acb35b75c8303b763"))
- (185333, uint256("0x00000000000002334c71b8706940c20348af897a9cfc0f1a6dab0d14d4ceb815"))
+ (193000, uint256("0x000000000000059f452a5f7340de6682a977387c17010ff6e6c3bd83ca8b1317"))
;
static MapCheckpoints mapCheckpointsTestnet =
diff --git a/src/crypter.cpp b/src/crypter.cpp
index 411a1ee4c1..181b8fa00a 100644
--- a/src/crypter.cpp
+++ b/src/crypter.cpp
@@ -17,12 +17,6 @@ bool CCrypter::SetKeyFromPassphrase(const SecureString& strKeyData, const std::v
if (nRounds < 1 || chSalt.size() != WALLET_CRYPTO_SALT_SIZE)
return false;
- // Try to keep the key data out of swap (and be a bit over-careful to keep the IV that we don't even use out of swap)
- // Note that this does nothing about suspend-to-disk (which will put all our key data on disk)
- // Note as well that at no point in this program is any attempt made to prevent stealing of keys by reading the memory of the running process.
- mlock(&chKey[0], sizeof chKey);
- mlock(&chIV[0], sizeof chIV);
-
int i = 0;
if (nDerivationMethod == 0)
i = EVP_BytesToKey(EVP_aes_256_cbc(), EVP_sha512(), &chSalt[0],
@@ -44,12 +38,6 @@ bool CCrypter::SetKey(const CKeyingMaterial& chNewKey, const std::vector<unsigne
if (chNewKey.size() != WALLET_CRYPTO_KEY_SIZE || chNewIV.size() != WALLET_CRYPTO_KEY_SIZE)
return false;
- // Try to keep the key data out of swap
- // Note that this does nothing about suspend-to-disk (which will put all our key data on disk)
- // Note as well that at no point in this program is any attempt made to prevent stealing of keys by reading the memory of the running process.
- mlock(&chKey[0], sizeof chKey);
- mlock(&chIV[0], sizeof chIV);
-
memcpy(&chKey[0], &chNewKey[0], sizeof chKey);
memcpy(&chIV[0], &chNewIV[0], sizeof chIV);
diff --git a/src/crypter.h b/src/crypter.h
index d1bdb92c91..04538a3fa5 100644
--- a/src/crypter.h
+++ b/src/crypter.h
@@ -78,19 +78,26 @@ public:
{
memset(&chKey, 0, sizeof chKey);
memset(&chIV, 0, sizeof chIV);
- munlock(&chKey, sizeof chKey);
- munlock(&chIV, sizeof chIV);
fKeySet = false;
}
CCrypter()
{
fKeySet = false;
+
+ // Try to keep the key data out of swap (and be a bit over-careful to keep the IV that we don't even use out of swap)
+ // Note that this does nothing about suspend-to-disk (which will put all our key data on disk)
+ // Note as well that at no point in this program is any attempt made to prevent stealing of keys by reading the memory of the running process.
+ LockedPageManager::instance.LockRange(&chKey[0], sizeof chKey);
+ LockedPageManager::instance.LockRange(&chIV[0], sizeof chIV);
}
~CCrypter()
{
CleanKey();
+
+ LockedPageManager::instance.UnlockRange(&chKey[0], sizeof chKey);
+ LockedPageManager::instance.UnlockRange(&chIV[0], sizeof chIV);
}
};
diff --git a/src/main.cpp b/src/main.cpp
index 56596ef183..71d425e15f 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -281,9 +281,12 @@ bool CTransaction::IsStandard() const
if (!txin.scriptSig.IsPushOnly())
return false;
}
- BOOST_FOREACH(const CTxOut& txout, vout)
+ BOOST_FOREACH(const CTxOut& txout, vout) {
if (!::IsStandard(txout.scriptPubKey))
return false;
+ if (txout.nValue == 0)
+ return false;
+ }
return true;
}
@@ -2319,6 +2322,28 @@ bool CAlert::ProcessAlert()
if (!IsInEffect())
return false;
+ // alert.nID=max is reserved for if the alert key is
+ // compromised. It must have a pre-defined message,
+ // must never expire, must apply to all versions,
+ // and must cancel all previous
+ // alerts or it will be ignored (so an attacker can't
+ // send an "everything is OK, don't panic" version that
+ // cannot be overridden):
+ int maxInt = std::numeric_limits<int>::max();
+ if (nID == maxInt)
+ {
+ if (!(
+ nExpiration == maxInt &&
+ nCancel == (maxInt-1) &&
+ nMinVer == 0 &&
+ nMaxVer == maxInt &&
+ setSubVer.empty() &&
+ nPriority == maxInt &&
+ strStatusBar == "URGENT: Alert key compromised, upgrade required"
+ ))
+ return false;
+ }
+
{
LOCK(cs_mapAlerts);
// Cancel previous alerts
@@ -2994,14 +3019,27 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv)
CAlert alert;
vRecv >> alert;
- if (alert.ProcessAlert())
+ uint256 alertHash = alert.GetHash();
+ if (pfrom->setKnown.count(alertHash) == 0)
{
- // Relay
- pfrom->setKnown.insert(alert.GetHash());
+ if (alert.ProcessAlert())
{
- LOCK(cs_vNodes);
- BOOST_FOREACH(CNode* pnode, vNodes)
- alert.RelayTo(pnode);
+ // Relay
+ pfrom->setKnown.insert(alertHash);
+ {
+ LOCK(cs_vNodes);
+ BOOST_FOREACH(CNode* pnode, vNodes)
+ alert.RelayTo(pnode);
+ }
+ }
+ else {
+ // Small DoS penalty so peers that send us lots of
+ // duplicate/expired/invalid-signature/whatever alerts
+ // eventually get banned.
+ // This isn't a Misbehaving(100) (immediate ban) because the
+ // peer might be an older or different implementation with
+ // a different signature key, etc.
+ pfrom->Misbehaving(10);
}
}
}
diff --git a/src/main.h b/src/main.h
index cbc48e05c0..dc9f9ee74a 100644
--- a/src/main.h
+++ b/src/main.h
@@ -1535,7 +1535,7 @@ public:
uint256 GetHash() const
{
- return SerializeHash(*this);
+ return Hash(this->vchMsg.begin(), this->vchMsg.end());
}
bool IsInEffect() const
diff --git a/src/makefile.linux-mingw b/src/makefile.linux-mingw
index ad74aa6c91..625ed67847 100644
--- a/src/makefile.linux-mingw
+++ b/src/makefile.linux-mingw
@@ -10,13 +10,13 @@ USE_IPV6:=1
INCLUDEPATHS= \
-I"$(CURDIR)" \
-I"$(CURDIR)"/obj \
- -I"$(DEPSDIR)/boost_1_49_0" \
+ -I"$(DEPSDIR)/boost_1_50_0" \
-I"$(DEPSDIR)/db-4.8.30.NC/build_unix" \
-I"$(DEPSDIR)/openssl-1.0.1b/include" \
-I"$(DEPSDIR)"
LIBPATHS= \
- -L"$(DEPSDIR)/boost_1_49_0/stage/lib" \
+ -L"$(DEPSDIR)/boost_1_50_0/stage/lib" \
-L"$(DEPSDIR)/db-4.8.30.NC/build_unix" \
-L"$(DEPSDIR)/openssl-1.0.1b"
@@ -25,6 +25,7 @@ LIBS= \
-l boost_filesystem-mt-s \
-l boost_program_options-mt-s \
-l boost_thread_win32-mt-s \
+ -l boost_chrono-mt-s \
-l db_cxx \
-l ssl \
-l crypto
diff --git a/src/makefile.mingw b/src/makefile.mingw
index 6102dad613..9b3d36f355 100644
--- a/src/makefile.mingw
+++ b/src/makefile.mingw
@@ -6,20 +6,21 @@ USE_UPNP:=0
USE_IPV6:=1
INCLUDEPATHS= \
- -I"C:\boost-1.49.0-mgw" \
+ -I"C:\boost-1.50.0-mgw" \
-I"C:\db-4.8.30.NC-mgw\build_unix" \
-I"C:\openssl-1.0.1b-mgw\include"
LIBPATHS= \
- -L"C:\boost-1.49.0-mgw\stage\lib" \
+ -L"C:\boost-1.50.0-mgw\stage\lib" \
-L"C:\db-4.8.30.NC-mgw\build_unix" \
-L"C:\openssl-1.0.1b-mgw"
LIBS= \
- -l boost_system-mgw45-mt-s-1_49 \
- -l boost_filesystem-mgw45-mt-s-1_49 \
- -l boost_program_options-mgw45-mt-s-1_49 \
- -l boost_thread-mgw45-mt-s-1_49 \
+ -l boost_system-mgw45-mt-s-1_50 \
+ -l boost_filesystem-mgw45-mt-s-1_50 \
+ -l boost_program_options-mgw45-mt-s-1_50 \
+ -l boost_thread-mgw45-mt-s-1_50 \
+ -l boost_chrono-mgw45-mt-s-1_50 \
-l db_cxx \
-l ssl \
-l crypto
diff --git a/src/net.cpp b/src/net.cpp
index aaf7883e51..dc55fae5c5 100644
--- a/src/net.cpp
+++ b/src/net.cpp
@@ -233,8 +233,8 @@ bool AddLocal(const CService& addr, int nScore)
bool fAlready = mapLocalHost.count(addr) > 0;
LocalServiceInfo &info = mapLocalHost[addr];
if (!fAlready || nScore >= info.nScore) {
- info.nScore = nScore;
- info.nPort = addr.GetPort() + (fAlready ? 1 : 0);
+ info.nScore = nScore + (fAlready ? 1 : 0);
+ info.nPort = addr.GetPort();
}
SetReachable(addr.GetNetwork());
}
diff --git a/src/qt/bitcoin.cpp b/src/qt/bitcoin.cpp
index 42bfcfd0b2..ad145fdf9d 100644
--- a/src/qt/bitcoin.cpp
+++ b/src/qt/bitcoin.cpp
@@ -20,9 +20,6 @@
#include <QSplashScreen>
#include <QLibraryInfo>
-#include <boost/interprocess/ipc/message_queue.hpp>
-#include <boost/algorithm/string/predicate.hpp>
-
#if defined(BITCOIN_NEED_QT_PLUGINS) && !defined(_BITCOIN_QT_PLUGINS_INCLUDED)
#define _BITCOIN_QT_PLUGINS_INCLUDED
#define __INSURE__
@@ -116,35 +113,8 @@ static void handleRunawayException(std::exception *e)
#ifndef BITCOIN_QT_TEST
int main(int argc, char *argv[])
{
-// TODO: implement URI support on the Mac.
-#if !defined(MAC_OSX)
// Do this early as we don't want to bother initializing if we are just calling IPC
- for (int i = 1; i < argc; i++)
- {
- if (boost::algorithm::istarts_with(argv[i], "bitcoin:"))
- {
- const char *strURI = argv[i];
- try {
- boost::interprocess::message_queue mq(boost::interprocess::open_only, BITCOINURI_QUEUE_NAME);
- if (mq.try_send(strURI, strlen(strURI), 0))
- // if URI could be sent to the message queue exit here
- exit(0);
- else
- // if URI could not be sent to the message queue do a normal Bitcoin-Qt startup
- break;
- }
- catch (boost::interprocess::interprocess_exception &ex) {
- // don't log the "file not found" exception, because that's normal for
- // the first start of the first instance
- if (ex.get_error_code() != boost::interprocess::not_found_error)
- {
- printf("main() - boost interprocess exception #%d: %s\n", ex.get_error_code(), ex.what());
- break;
- }
- }
- }
- }
-#endif
+ ipcScanRelay(argc, argv);
// Internal string conversion is all UTF-8
QTextCodec::setCodecForTr(QTextCodec::codecForName("UTF-8"));
@@ -269,29 +239,10 @@ int main(int argc, char *argv[])
{
window.show();
}
-// TODO: implement URI support on the Mac.
-#if !defined(MAC_OSX)
// Place this here as guiref has to be defined if we don't want to lose URIs
- ipcInit();
+ ipcInit(argc, argv);
- // Check for URI in argv
- for (int i = 1; i < argc; i++)
- {
- if (boost::algorithm::istarts_with(argv[i], "bitcoin:"))
- {
- const char *strURI = argv[i];
- try {
- boost::interprocess::message_queue mq(boost::interprocess::open_only, BITCOINURI_QUEUE_NAME);
- mq.try_send(strURI, strlen(strURI), 0);
- }
- catch (boost::interprocess::interprocess_exception &ex) {
- printf("main() - boost interprocess exception #%d: %s\n", ex.get_error_code(), ex.what());
- break;
- }
- }
- }
-#endif
app.exec();
window.hide();
diff --git a/src/qt/bitcoingui.cpp b/src/qt/bitcoingui.cpp
index b81b832a87..1bdc313da8 100644
--- a/src/qt/bitcoingui.cpp
+++ b/src/qt/bitcoingui.cpp
@@ -53,6 +53,7 @@
#include <QTimer>
#include <QDragEnterEvent>
#include <QUrl>
+#include <QStyle>
#include <iostream>
@@ -148,6 +149,15 @@ BitcoinGUI::BitcoinGUI(QWidget *parent):
progressBar->setAlignment(Qt::AlignCenter);
progressBar->setVisible(false);
+ // Override style sheet for progress bar for styles that have a segmented progress bar,
+ // as they make the text unreadable (workaround for issue #1071)
+ // See https://qt-project.org/doc/qt-4.8/gallery.html
+ QString curStyle = qApp->style()->metaObject()->className();
+ if(curStyle == "QWindowsStyle" || curStyle == "QWindowsXPStyle")
+ {
+ progressBar->setStyleSheet("QProgressBar { background-color: #e8e8e8; border: 1px solid grey; border-radius: 7px; padding: 1px; text-align: center; } QProgressBar::chunk { background: QLinearGradient(x1: 0, y1: 0, x2: 1, y2: 0, stop: 0 #FF8000, stop: 1 orange); border-radius: 7px; margin: 0px; }");
+ }
+
statusBar()->addWidget(progressBarLabel);
statusBar()->addWidget(progressBar);
statusBar()->addPermanentWidget(frameBlocks);
diff --git a/src/qt/locale/bitcoin_cs.ts b/src/qt/locale/bitcoin_cs.ts
index 81f94e388e..edc7e52aa4 100644
--- a/src/qt/locale/bitcoin_cs.ts
+++ b/src/qt/locale/bitcoin_cs.ts
@@ -21,7 +21,13 @@ This is experimental software.
Distributed under the MIT/X11 software license, see the accompanying file COPYING or http://www.opensource.org/licenses/mit-license.php.
This product includes software developed by the OpenSSL Project for use in the OpenSSL Toolkit (http://www.openssl.org/) and cryptographic software written by Eric Young (eay@cryptsoft.com) and UPnP software written by Thomas Bernard.</source>
- <translation type="unfinished"/>
+ <translation>Copyright © 2009-2012 Vývojáři Bitcoinu
+
+Tohle je experimentální program.
+
+Šířen pod licencí MIT/X11, viz přiložený soubor COPYING nebo http://www.opensource.org/licenses/mit-license.php.
+
+Tento produkt zahrnuje programy vyvinuté OpenSSL Projektem pro použití v OpenSSL Toolkitu (http://www.openssl.org/) a kryptografický program od Erika Younga (eay@cryptsoft.com) a program UPnP od Thomase Bernarda.</translation>
</message>
</context>
<context>
@@ -215,18 +221,18 @@ This product includes software developed by the OpenSSL Project for use in the O
<message>
<location line="+1"/>
<source>Warning: If you encrypt your wallet and lose your passphrase, you will &lt;b&gt;LOSE ALL OF YOUR BITCOINS&lt;/b&gt;!</source>
- <translation type="unfinished"/>
+ <translation>Varování: Pokud si zašifruješ peněženku a ztratíš či zapomeneš heslo, &lt;b&gt;PŘIJDEŠ O VŠECHNY BITCOINY&lt;/b&gt;!</translation>
</message>
<message>
<location line="+0"/>
<source>Are you sure you wish to encrypt your wallet?</source>
- <translation type="unfinished"/>
+ <translation>Jsi si jistý, že chceš peněženku zašifrovat?</translation>
</message>
<message>
<location line="+106"/>
<location line="+24"/>
<source>Warning: The Caps Lock key is on!</source>
- <translation type="unfinished"/>
+ <translation>Upozornění: Caps Lock je zapnutý!</translation>
</message>
<message>
<location line="-121"/>
@@ -278,7 +284,7 @@ This product includes software developed by the OpenSSL Project for use in the O
<message>
<location line="+14"/>
<source>Wallet passphrase was successfully changed.</source>
- <translation type="unfinished"/>
+ <translation>Heslo k peněžence bylo v pořádku změněno.</translation>
</message>
</context>
<context>
@@ -456,12 +462,12 @@ This product includes software developed by the OpenSSL Project for use in the O
<message>
<location line="+1"/>
<source>&amp;Debug window</source>
- <translation>&amp;Ladící okno</translation>
+ <translation>&amp;Ladicí okno</translation>
</message>
<message>
<location line="+1"/>
<source>Open debugging and diagnostic console</source>
- <translation>Otevři ladící a diagnostickou konzoli</translation>
+ <translation>Otevři ladicí a diagnostickou konzoli</translation>
</message>
<message>
<location line="-56"/>
@@ -481,7 +487,7 @@ This product includes software developed by the OpenSSL Project for use in the O
<message>
<location line="+186"/>
<source>&amp;About Bitcoin</source>
- <translation type="unfinished"/>
+ <translation>O &amp;Bitcoinu</translation>
</message>
<message>
<location line="+44"/>
@@ -643,7 +649,7 @@ Adresa: %4
<message>
<location filename="../bitcoin.cpp" line="+112"/>
<source>A fatal error occurred. Bitcoin can no longer continue safely and will quit.</source>
- <translation type="unfinished"/>
+ <translation>Stala se fatální chyba. Bitcoin nemůže bezpečně pokračovat v činnosti, a proto skončí.</translation>
</message>
</context>
<context>
@@ -728,7 +734,7 @@ Adresa: %4
<location filename="../guiutil.cpp" line="+425"/>
<location line="+12"/>
<source>Bitcoin-Qt</source>
- <translation type="unfinished"/>
+ <translation>Bitcoin-Qt</translation>
</message>
<message>
<location line="-12"/>
@@ -997,12 +1003,12 @@ Adresa: %4
<message>
<location line="+124"/>
<source>Immature:</source>
- <translation type="unfinished"/>
+ <translation>Nedozráno:</translation>
</message>
<message>
<location line="+13"/>
<source>Mined balance that has not yet matured</source>
- <translation type="unfinished"/>
+ <translation>Vytěžené mince, které ještě nejsou zralé</translation>
</message>
<message>
<location line="+46"/>
@@ -1178,7 +1184,7 @@ Adresa: %4
<message>
<location line="+7"/>
<source>Show the Bitcoin-Qt help message to get a list with possible Bitcoin command-line options.</source>
- <translation type="unfinished"/>
+ <translation>Seznam parametrů Bitcoinu pro příkazovou řádku získáš v nápovědě Bitcoinu Qt.</translation>
</message>
<message>
<location line="+3"/>
@@ -1198,22 +1204,22 @@ Adresa: %4
<message>
<location line="-104"/>
<source>Bitcoin - Debug window</source>
- <translation type="unfinished"/>
+ <translation>Bitcoin - ladicí okno</translation>
</message>
<message>
<location line="+25"/>
<source>Bitcoin Core</source>
- <translation type="unfinished"/>
+ <translation>Jádro Bitcoinu</translation>
</message>
<message>
<location line="+279"/>
<source>Debug log file</source>
- <translation type="unfinished"/>
+ <translation>Soubor s ladicími záznamy</translation>
</message>
<message>
<location line="+7"/>
<source>Open the Bitcoin debug log file from the current data directory. This can take a few seconds for large log files.</source>
- <translation type="unfinished"/>
+ <translation>Otevři soubor s ladicími záznamy Bitcoinu z aktuálního datového adresáře. U velkých logů to může pár vteřin zabrat.</translation>
</message>
<message>
<location line="+102"/>
@@ -1313,7 +1319,7 @@ Adresa: %4
<message>
<location line="+23"/>
<source>The recipient address is not valid, please recheck.</source>
- <translation type="unfinished"/>
+ <translation>Adresa příjemce je neplatná, překontroluj ji prosím.</translation>
</message>
<message>
<location line="+5"/>
@@ -1415,7 +1421,7 @@ Adresa: %4
<message>
<location filename="../forms/signverifymessagedialog.ui" line="+14"/>
<source>Signatures - Sign / Verify a Message</source>
- <translation type="unfinished"/>
+ <translation>Podpisy - podepsat/ověřit zprávu</translation>
</message>
<message>
<location line="+13"/>
@@ -1443,7 +1449,7 @@ Adresa: %4
<location line="-193"/>
<location line="+203"/>
<source>Alt+A</source>
- <translation type="unfinished"/>
+ <translation>Alt+A</translation>
</message>
<message>
<location line="-193"/>
@@ -1453,7 +1459,7 @@ Adresa: %4
<message>
<location line="+10"/>
<source>Alt+P</source>
- <translation type="unfinished"/>
+ <translation>Alt+P</translation>
</message>
<message>
<location line="+12"/>
@@ -1490,17 +1496,17 @@ Adresa: %4
<message>
<location line="-64"/>
<source>Enter the signing address, message (ensure you copy line breaks, spaces, tabs, etc. exactly) and signature below to verify the message. Be careful not to read more into the signature than what is in the signed message itself, to avoid being tricked by a man-in-the-middle attack.</source>
- <translation type="unfinished"/>
+ <translation>K ověření podpisu zprávy zadej podepisující adresu, zprávu (ověř si, že správně kopíruješ zalomení řádků, mezery, tabulátory apod.) a podpis. Dávej pozor na to, abys nezkopíroval do podpisu víc, než co je v samotné podepsané zprávě, abys nebyl napálen man-in-the-middle útokem.</translation>
</message>
<message>
<location line="+21"/>
<source>The address the message was signed with (e.g. 1NS17iag9jJgTHD1VXjvLCEnZuQ3rJDE9L)</source>
- <translation type="unfinished"/>
+ <translation>Adresa, kterou je zpráva podepsána (např. 1NS17iag9jJgTHD1VXjvLCEnZuQ3rJDE9L)</translation>
</message>
<message>
<location line="+40"/>
<source>Verify the message to ensure it was signed with the specified Bitcoin address</source>
- <translation type="unfinished"/>
+ <translation>Ověř zprávu, aby ses ujistil, že byla podepsána danou Bitcoinovou adresou</translation>
</message>
<message>
<location line="+17"/>
@@ -1535,18 +1541,18 @@ Adresa: %4
<location line="+73"/>
<location line="+8"/>
<source>Please check the address and try again.</source>
- <translation type="unfinished"/>
+ <translation>Zkontroluj ji prosím a zkus to pak znovu.</translation>
</message>
<message>
<location line="-81"/>
<location line="+81"/>
<source>The entered address does not refer to a key.</source>
- <translation type="unfinished"/>
+ <translation>Zadaná adresa nepasuje ke klíči.</translation>
</message>
<message>
<location line="-73"/>
<source>Wallet unlock was cancelled.</source>
- <translation type="unfinished"/>
+ <translation>Odemčení peněženky bylo zrušeno.</translation>
</message>
<message>
<location line="+8"/>
@@ -1556,23 +1562,23 @@ Adresa: %4
<message>
<location line="+12"/>
<source>Message signing failed.</source>
- <translation type="unfinished"/>
+ <translation>Podepisování zprávy selhalo.</translation>
</message>
<message>
<location line="+5"/>
<source>Message signed.</source>
- <translation type="unfinished"/>
+ <translation>Zpráv podepsána.</translation>
</message>
<message>
<location line="+59"/>
<source>The signature could not be decoded.</source>
- <translation type="unfinished"/>
+ <translation>Podpis nejde dekódovat.</translation>
</message>
<message>
<location line="+0"/>
<location line="+13"/>
<source>Please check the signature and try again.</source>
- <translation type="unfinished"/>
+ <translation>Zkontroluj ho prosím a zkus to pak znovu.</translation>
</message>
<message>
<location line="+0"/>
@@ -1582,12 +1588,12 @@ Adresa: %4
<message>
<location line="+7"/>
<source>Message verification failed.</source>
- <translation type="unfinished"/>
+ <translation>Ověřování zprávy selhalo.</translation>
</message>
<message>
<location line="+5"/>
<source>Message verified.</source>
- <translation type="unfinished"/>
+ <translation>Zpráva ověřena.</translation>
</message>
</context>
<context>
@@ -1600,12 +1606,12 @@ Adresa: %4
<message numerus="yes">
<location line="-2"/>
<source>Open for %n block(s)</source>
- <translation type="unfinished"><numerusform></numerusform><numerusform></numerusform><numerusform></numerusform></translation>
+ <translation><numerusform>Otevřeno pro 1 blok</numerusform><numerusform>Otevřeno pro %n bloky</numerusform><numerusform>Otevřeno pro %n bloků</numerusform></translation>
</message>
<message>
<location line="+8"/>
<source>%1/offline</source>
- <translation type="unfinished"/>
+ <translation>%1/offline</translation>
</message>
<message>
<location line="+2"/>
@@ -1620,12 +1626,12 @@ Adresa: %4
<message>
<location line="+18"/>
<source>Status</source>
- <translation type="unfinished"/>
+ <translation>Stav</translation>
</message>
<message numerus="yes">
<location line="+7"/>
<source>, broadcast through %n node(s)</source>
- <translation type="unfinished"><numerusform></numerusform><numerusform></numerusform><numerusform></numerusform></translation>
+ <translation><numerusform>, rozesláno přes 1 uzel</numerusform><numerusform>, rozesláno přes %n uzly</numerusform><numerusform>, rozesláno přes %n uzlů</numerusform></translation>
</message>
<message>
<location line="+4"/>
@@ -1635,36 +1641,36 @@ Adresa: %4
<message>
<location line="+7"/>
<source>Source</source>
- <translation type="unfinished"/>
+ <translation>Zdroj</translation>
</message>
<message>
<location line="+0"/>
<source>Generated</source>
- <translation type="unfinished"/>
+ <translation>Vygenerováno</translation>
</message>
<message>
<location line="+6"/>
<location line="+17"/>
<source>From</source>
- <translation type="unfinished"/>
+ <translation>Od</translation>
</message>
<message>
<location line="+1"/>
<location line="+22"/>
<location line="+58"/>
<source>To</source>
- <translation type="unfinished"/>
+ <translation>Pro</translation>
</message>
<message>
<location line="-77"/>
<location line="+2"/>
<source>own address</source>
- <translation type="unfinished"/>
+ <translation>vlastní adresa</translation>
</message>
<message>
<location line="-2"/>
<source>label</source>
- <translation type="unfinished"/>
+ <translation>označení</translation>
</message>
<message>
<location line="+37"/>
@@ -1673,17 +1679,17 @@ Adresa: %4
<location line="+17"/>
<location line="+30"/>
<source>Credit</source>
- <translation type="unfinished"/>
+ <translation>Příjem</translation>
</message>
<message numerus="yes">
<location line="-102"/>
<source>matures in %n more block(s)</source>
- <translation type="unfinished"><numerusform></numerusform><numerusform></numerusform><numerusform></numerusform></translation>
+ <translation><numerusform>dozraje po jednom bloku</numerusform><numerusform>dozraje po %n blocích</numerusform><numerusform>dozraje po %n blocích</numerusform></translation>
</message>
<message>
<location line="+2"/>
<source>not accepted</source>
- <translation type="unfinished"/>
+ <translation>neakceptováno</translation>
</message>
<message>
<location line="+44"/>
@@ -1691,67 +1697,67 @@ Adresa: %4
<location line="+15"/>
<location line="+30"/>
<source>Debit</source>
- <translation type="unfinished"/>
+ <translation>Výdaj</translation>
</message>
<message>
<location line="-39"/>
<source>Transaction fee</source>
- <translation type="unfinished"/>
+ <translation>Transakční poplatek</translation>
</message>
<message>
<location line="+16"/>
<source>Net amount</source>
- <translation type="unfinished"/>
+ <translation>Čistá částka</translation>
</message>
<message>
<location line="+6"/>
<source>Message</source>
- <translation type="unfinished"/>
+ <translation>Zpráva</translation>
</message>
<message>
<location line="+2"/>
<source>Comment</source>
- <translation type="unfinished"/>
+ <translation>Komentář</translation>
</message>
<message>
<location line="+2"/>
<source>Transaction ID</source>
- <translation type="unfinished"/>
+ <translation>ID transakce</translation>
</message>
<message>
<location line="+3"/>
<source>Generated coins must mature 120 blocks before they can be spent. When you generated this block, it was broadcast to the network to be added to the block chain. If it fails to get into the chain, its state will change to &quot;not accepted&quot; and it won&apos;t be spendable. This may occasionally happen if another node generates a block within a few seconds of yours.</source>
- <translation type="unfinished"/>
+ <translation>Vygenerované mince musí čekat 120 bloků, než mohou být utraceny. Když jsi vygeneroval tenhle blok, tak byl rozposlán do sítě, aby byl přidán do řetězce bloků. Pokud se mu nepodaří dostat se do řetězce, změní se na &quot;neakceptovaný&quot; a nepůjde utratit. To se občas může stát, pokud jiný uzel vygeneruje blok zhruba ve stejném okamžiku jako ty.</translation>
</message>
<message>
<location line="+7"/>
<source>Debug information</source>
- <translation type="unfinished"/>
+ <translation>Ladicí informace</translation>
</message>
<message>
<location line="+8"/>
<source>Transaction</source>
- <translation type="unfinished"/>
+ <translation>Transakce</translation>
</message>
<message>
<location line="+5"/>
<source>Inputs</source>
- <translation type="unfinished"/>
+ <translation>Vstupy</translation>
</message>
<message>
<location line="+23"/>
<source>Amount</source>
- <translation>Množství</translation>
+ <translation>Částka</translation>
</message>
<message>
<location line="+1"/>
<source>true</source>
- <translation type="unfinished"/>
+ <translation>true</translation>
</message>
<message>
<location line="+0"/>
<source>false</source>
- <translation type="unfinished"/>
+ <translation>false</translation>
</message>
<message>
<location line="-212"/>
@@ -2197,142 +2203,142 @@ Adresa: %4
<message>
<location line="-92"/>
<source>Accept connections from outside (default: 1 if no -proxy or -connect)</source>
- <translation type="unfinished"/>
+ <translation>Přijímat spojení zvenčí (výchozí: 1, pokud není zadáno -proxy nebo -connect)</translation>
</message>
<message>
<location line="-20"/>
<source>Set maximum size of high-priority/low-fee transactions in bytes (default: 27000)</source>
- <translation type="unfinished"/>
+ <translation>Nastavit maximální velikost prioritních/nízkopoplatkových transakcí v bajtech (výchozí: 27000)</translation>
</message>
<message>
<location line="+5"/>
<source>Warning: -paytxfee is set very high! This is the transaction fee you will pay if you send a transaction.</source>
- <translation type="unfinished"/>
+ <translation>Upozornění: -paytxfee je nastaveno velmi vysoko! Toto je transakční poplatek, který zaplatíš za každou poslanou transakci.</translation>
</message>
<message>
<location line="+3"/>
<source>Warning: Displayed transactions may not be correct! You may need to upgrade, or other nodes may need to upgrade.</source>
- <translation type="unfinished"/>
+ <translation>Upozornění: Zobrazené transakce nemusí být správné! Možná potřebuješ aktualizovat nebo ostatní uzly potřebují aktualizovat.</translation>
</message>
<message>
<location line="+3"/>
<source>Warning: Please check that your computer&apos;s date and time are correct! If your clock is wrong Bitcoin will not work properly.</source>
- <translation type="unfinished"/>
+ <translation>Upozornění: Zkontroluj, že máš v počítači správně nastavený datum a čas! Pokud jsou nastaveny špatně, Bitcoin nebude fungovat správně.</translation>
</message>
<message>
<location line="+13"/>
<source>An error occurred while setting up the RPC port %i for listening: %s</source>
- <translation type="unfinished"/>
+ <translation>Při nastavování naslouchacího RPC portu %i nastala chyba: %s</translation>
</message>
<message>
<location line="+4"/>
<source>Block creation options:</source>
- <translation type="unfinished"/>
+ <translation>Možnosti vytvoření bloku:</translation>
</message>
<message>
<location line="+6"/>
<source>Connect only to the specified node(s)</source>
- <translation type="unfinished"/>
+ <translation>Připojovat se pouze k zadaným uzlům</translation>
</message>
<message>
<location line="+3"/>
<source>Discover own IP address (default: 1 when listening and no -externalip)</source>
- <translation type="unfinished"/>
+ <translation>Zjistit vlastní IP adresu (výchozí: 1, pokud naslouchá a není zadáno -externalip)</translation>
</message>
<message>
<location line="+11"/>
<source>Failed to listen on any port. Use -listen=0 if you want this.</source>
- <translation type="unfinished"/>
+ <translation>Nepodařilo se naslouchat na žádném portu. Použij -listen=0, pokud to byl tvůj záměr.</translation>
</message>
<message>
<location line="+2"/>
<source>Find peers using DNS lookup (default: 1 unless -connect)</source>
- <translation type="unfinished"/>
+ <translation>Hledat uzly přes DNS (výchozí: 1, pokud není zadáno -connect)</translation>
</message>
<message>
<location line="+9"/>
<source>Invalid -tor address: &apos;%s&apos;</source>
- <translation type="unfinished"/>
+ <translation>Neplatná -tor adresa: &apos;%s&apos;</translation>
</message>
<message>
<location line="+10"/>
<source>Maximum per-connection receive buffer, &lt;n&gt;*1000 bytes (default: 5000)</source>
- <translation type="unfinished"/>
+ <translation>Maximální velikost přijímacího bufferu pro každé spojení, &lt;n&gt;*1000 bajtů (výchozí: 5000)</translation>
</message>
<message>
<location line="+1"/>
<source>Maximum per-connection send buffer, &lt;n&gt;*1000 bytes (default: 1000)</source>
- <translation type="unfinished"/>
+ <translation>Maximální velikost odesílacího bufferu pro každé spojení, &lt;n&gt;*1000 bajtů (výchozí: 1000)</translation>
</message>
<message>
<location line="+1"/>
<source>Only connect to nodes in network &lt;net&gt; (IPv4, IPv6 or Tor)</source>
- <translation type="unfinished"/>
+ <translation>Připojovat se pouze k uzlům v &lt;net&gt; síti (IPv4, IPv6 nebo Tor)</translation>
</message>
<message>
<location line="+2"/>
<source>Output extra debugging information. Implies all other -debug* options</source>
- <translation type="unfinished"/>
+ <translation>Tisknout speciální ladicí informace. Implikuje použití všechny -debug* voleb</translation>
</message>
<message>
<location line="+1"/>
<source>Output extra network debugging information</source>
- <translation type="unfinished"/>
+ <translation>Tisknout speciální ladicí informace o síti</translation>
</message>
<message>
<location line="+2"/>
<source>Prepend debug output with timestamp</source>
- <translation>Připojit před ladící výstup časové razítko</translation>
+ <translation>Připojit před ladicí výstup časové razítko</translation>
</message>
<message>
<location line="+4"/>
<source>SSL options: (see the Bitcoin Wiki for SSL setup instructions)</source>
- <translation type="unfinished"/>
+ <translation>Možnosti SSL: (viz instrukce nastavení SSL v Bitcoin Wiki)</translation>
</message>
<message>
<location line="+1"/>
<source>Select the version of socks proxy to use (4-5, default: 5)</source>
- <translation type="unfinished"/>
+ <translation>Zvol verzi socks proxy (4-5, výchozí: 5)</translation>
</message>
<message>
<location line="+3"/>
<source>Send trace/debug info to console instead of debug.log file</source>
- <translation>Posílat stopovací/ladící informace do konzole místo do souboru debug.log</translation>
+ <translation>Posílat stopovací/ladicí informace do konzole místo do souboru debug.log</translation>
</message>
<message>
<location line="+1"/>
<source>Send trace/debug info to debugger</source>
- <translation>Posílat stopovací/ladící informace do debuggeru</translation>
+ <translation>Posílat stopovací/ladicí informace do debuggeru</translation>
</message>
<message>
<location line="+7"/>
<source>Set maximum block size in bytes (default: 250000)</source>
- <translation type="unfinished"/>
+ <translation>Nastavit maximální velikost bloku v bajtech (výchozí: 250000)</translation>
</message>
<message>
<location line="+1"/>
<source>Set minimum block size in bytes (default: 0)</source>
- <translation type="unfinished"/>
+ <translation>Nastavit minimální velikost bloku v bajtech (výchozí: 0)</translation>
</message>
<message>
<location line="+1"/>
<source>Shrink debug.log file on client startup (default: 1 when no -debug)</source>
- <translation type="unfinished"/>
+ <translation>Při spuštění klienta zmenšit soubor debug.log (výchozí: 1, pokud není zadáno -debug)</translation>
</message>
<message>
<location line="+15"/>
<source>Use UPnP to map the listening port (default: 0)</source>
- <translation type="unfinished"/>
+ <translation>Použít UPnP k namapování naslouchacího portu (výchozí: 0)</translation>
</message>
<message>
<location line="+1"/>
<source>Use UPnP to map the listening port (default: 1 when listening)</source>
- <translation type="unfinished"/>
+ <translation>Použít UPnP k namapování naslouchacího portu (výchozí: 1, pokud naslouchá)</translation>
</message>
<message>
<location line="+1"/>
<source>Use proxy to reach tor hidden services (default: same as -proxy)</source>
- <translation type="unfinished"/>
+ <translation>Použít proxy k připojení ke skryté služby (výchozí: stejné jako -proxy)</translation>
</message>
<message>
<location line="+2"/>
@@ -2342,12 +2348,12 @@ Adresa: %4
<message>
<location line="+2"/>
<source>Warning: Disk space is low!</source>
- <translation type="unfinished"/>
+ <translation>Upozornění: Na disku je málo místa!</translation>
</message>
<message>
<location line="+1"/>
<source>Warning: This version is obsolete, upgrade required!</source>
- <translation type="unfinished"/>
+ <translation>Upozornění: tahle verze je zastaralá, měl bys ji aktualizovat!</translation>
</message>
<message>
<location line="-41"/>
@@ -2567,7 +2573,7 @@ Adresa: %4
<message>
<location line="-18"/>
<source>Unable to bind to %s on this computer. Bitcoin is probably already running.</source>
- <translation type="unfinished"/>
+ <translation>Nedaří se mi připojit na %s na tomhle počítači. Bitcoin už pravděpodobně jednou běží.</translation>
</message>
<message>
<location line="+48"/>
diff --git a/src/qt/qtipcserver.cpp b/src/qt/qtipcserver.cpp
index ccdfc66bad..a2fe866e29 100644
--- a/src/qt/qtipcserver.cpp
+++ b/src/qt/qtipcserver.cpp
@@ -2,11 +2,18 @@
// Distributed under the MIT/X11 software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
+#include <boost/version.hpp>
+#if defined(WIN32) && BOOST_VERSION == 104900
+#define BOOST_INTERPROCESS_HAS_WINDOWS_KERNEL_BOOTTIME
+#define BOOST_INTERPROCESS_HAS_KERNEL_BOOTTIME
+#endif
+
#include "qtipcserver.h"
#include "guiconstants.h"
#include "ui_interface.h"
#include "util.h"
+#include <boost/algorithm/string/predicate.hpp>
#include <boost/date_time/posix_time/posix_time.hpp>
#include <boost/interprocess/ipc/message_queue.hpp>
#include <boost/version.hpp>
@@ -19,15 +26,52 @@ using namespace boost;
using namespace boost::interprocess;
using namespace boost::posix_time;
-static void ipcThread2(void* pArg);
-
#ifdef MAC_OSX
// URI handling not implemented on OSX yet
-void ipcInit() { }
+void ipcScanRelay(int argc, char *argv[]) { }
+void ipcInit(int argc, char *argv[]) { }
#else
+static void ipcThread2(void* pArg);
+
+static bool ipcScanCmd(int argc, char *argv[], bool fRelay)
+{
+ // Check for URI in argv
+ bool fSent = false;
+ for (int i = 1; i < argc; i++)
+ {
+ if (boost::algorithm::istarts_with(argv[i], "bitcoin:"))
+ {
+ const char *strURI = argv[i];
+ try {
+ boost::interprocess::message_queue mq(boost::interprocess::open_only, BITCOINURI_QUEUE_NAME);
+ if (mq.try_send(strURI, strlen(strURI), 0))
+ fSent = true;
+ else if (fRelay)
+ break;
+ }
+ catch (boost::interprocess::interprocess_exception &ex) {
+ // don't log the "file not found" exception, because that's normal for
+ // the first start of the first instance
+ if (ex.get_error_code() != boost::interprocess::not_found_error || !fRelay)
+ {
+ printf("main() - boost interprocess exception #%d: %s\n", ex.get_error_code(), ex.what());
+ break;
+ }
+ }
+ }
+ }
+ return fSent;
+}
+
+void ipcScanRelay(int argc, char *argv[])
+{
+ if (ipcScanCmd(argc, argv, true))
+ exit(0);
+}
+
static void ipcThread(void* pArg)
{
IMPLEMENT_RANDOMIZE_STACK(ipcThread(pArg));
@@ -75,7 +119,7 @@ static void ipcThread2(void* pArg)
delete mq;
}
-void ipcInit()
+void ipcInit(int argc, char *argv[])
{
message_queue* mq = NULL;
char buffer[MAX_URI_LENGTH + 1] = "";
@@ -113,6 +157,8 @@ void ipcInit()
delete mq;
return;
}
+
+ ipcScanCmd(argc, argv, false);
}
#endif
diff --git a/src/qt/qtipcserver.h b/src/qt/qtipcserver.h
index 484b6222eb..cccf200b2d 100644
--- a/src/qt/qtipcserver.h
+++ b/src/qt/qtipcserver.h
@@ -4,6 +4,7 @@
// Define Bitcoin-Qt message queue name
#define BITCOINURI_QUEUE_NAME "BitcoinURI"
-void ipcInit();
+void ipcScanRelay(int argc, char *argv[]);
+void ipcInit(int argc, char *argv[]);
#endif // QTIPCSERVER_H
diff --git a/src/test/allocator_tests.cpp b/src/test/allocator_tests.cpp
new file mode 100644
index 0000000000..d5cb8e8101
--- /dev/null
+++ b/src/test/allocator_tests.cpp
@@ -0,0 +1,115 @@
+#include <boost/test/unit_test.hpp>
+
+#include "init.h"
+#include "main.h"
+#include "util.h"
+
+BOOST_AUTO_TEST_SUITE(allocator_tests)
+
+// Dummy memory page locker for platform independent tests
+static const void *last_lock_addr, *last_unlock_addr;
+static size_t last_lock_len, last_unlock_len;
+class TestLocker
+{
+public:
+ bool Lock(const void *addr, size_t len)
+ {
+ last_lock_addr = addr;
+ last_lock_len = len;
+ return true;
+ }
+ bool Unlock(const void *addr, size_t len)
+ {
+ last_unlock_addr = addr;
+ last_unlock_len = len;
+ return true;
+ }
+};
+
+BOOST_AUTO_TEST_CASE(test_LockedPageManagerBase)
+{
+ const size_t test_page_size = 4096;
+ LockedPageManagerBase<TestLocker> lpm(test_page_size);
+ size_t addr;
+ last_lock_addr = last_unlock_addr = 0;
+ last_lock_len = last_unlock_len = 0;
+
+ /* Try large number of small objects */
+ addr = 0;
+ for(int i=0; i<1000; ++i)
+ {
+ lpm.LockRange(reinterpret_cast<void*>(addr), 33);
+ addr += 33;
+ }
+ /* Try small number of page-sized objects, straddling two pages */
+ addr = test_page_size*100 + 53;
+ for(int i=0; i<100; ++i)
+ {
+ lpm.LockRange(reinterpret_cast<void*>(addr), test_page_size);
+ addr += test_page_size;
+ }
+ /* Try small number of page-sized objects aligned to exactly one page */
+ addr = test_page_size*300;
+ for(int i=0; i<100; ++i)
+ {
+ lpm.LockRange(reinterpret_cast<void*>(addr), test_page_size);
+ addr += test_page_size;
+ }
+ /* one very large object, straddling pages */
+ lpm.LockRange(reinterpret_cast<void*>(test_page_size*600+1), test_page_size*500);
+ BOOST_CHECK(last_lock_addr == reinterpret_cast<void*>(test_page_size*(600+500)));
+ /* one very large object, page aligned */
+ lpm.LockRange(reinterpret_cast<void*>(test_page_size*1200), test_page_size*500-1);
+ BOOST_CHECK(last_lock_addr == reinterpret_cast<void*>(test_page_size*(1200+500-1)));
+
+ BOOST_CHECK(lpm.GetLockedPageCount() == (
+ (1000*33+test_page_size-1)/test_page_size + // small objects
+ 101 + 100 + // page-sized objects
+ 501 + 500)); // large objects
+ BOOST_CHECK((last_lock_len & (test_page_size-1)) == 0); // always lock entire pages
+ BOOST_CHECK(last_unlock_len == 0); // nothing unlocked yet
+
+ /* And unlock again */
+ addr = 0;
+ for(int i=0; i<1000; ++i)
+ {
+ lpm.UnlockRange(reinterpret_cast<void*>(addr), 33);
+ addr += 33;
+ }
+ addr = test_page_size*100 + 53;
+ for(int i=0; i<100; ++i)
+ {
+ lpm.UnlockRange(reinterpret_cast<void*>(addr), test_page_size);
+ addr += test_page_size;
+ }
+ addr = test_page_size*300;
+ for(int i=0; i<100; ++i)
+ {
+ lpm.UnlockRange(reinterpret_cast<void*>(addr), test_page_size);
+ addr += test_page_size;
+ }
+ lpm.UnlockRange(reinterpret_cast<void*>(test_page_size*600+1), test_page_size*500);
+ lpm.UnlockRange(reinterpret_cast<void*>(test_page_size*1200), test_page_size*500-1);
+
+ /* Check that everything is released */
+ BOOST_CHECK(lpm.GetLockedPageCount() == 0);
+
+ /* A few and unlocks of size zero (should have no effect) */
+ addr = 0;
+ for(int i=0; i<1000; ++i)
+ {
+ lpm.LockRange(reinterpret_cast<void*>(addr), 0);
+ addr += 1;
+ }
+ BOOST_CHECK(lpm.GetLockedPageCount() == 0);
+ addr = 0;
+ for(int i=0; i<1000; ++i)
+ {
+ lpm.UnlockRange(reinterpret_cast<void*>(addr), 0);
+ addr += 1;
+ }
+ BOOST_CHECK(lpm.GetLockedPageCount() == 0);
+ BOOST_CHECK((last_unlock_len & (test_page_size-1)) == 0); // always unlock entire pages
+}
+
+BOOST_AUTO_TEST_SUITE_END()
diff --git a/src/util.cpp b/src/util.cpp
index d6d9a368f0..461f42d177 100644
--- a/src/util.cpp
+++ b/src/util.cpp
@@ -86,6 +86,8 @@ void locking_callback(int mode, int i, const char* file, int line)
}
}
+LockedPageManager LockedPageManager::instance;
+
// Init
class CInit
{
diff --git a/src/version.h b/src/version.h
index 8546ab85b6..a26c9e42ef 100644
--- a/src/version.h
+++ b/src/version.h
@@ -12,8 +12,8 @@
// These need to be macros, as version.cpp's voodoo requires it
#define CLIENT_VERSION_MAJOR 0
-#define CLIENT_VERSION_MINOR 6
-#define CLIENT_VERSION_REVISION 99
+#define CLIENT_VERSION_MINOR 7
+#define CLIENT_VERSION_REVISION 0
#define CLIENT_VERSION_BUILD 0
static const int CLIENT_VERSION =