aboutsummaryrefslogtreecommitdiff
path: root/src/qt/qtipcserver.cpp
diff options
context:
space:
mode:
authorPhilip Kaufmann <phil.kaufmann@t-online.de>2013-01-03 22:06:18 +0100
committerPhilip Kaufmann <phil.kaufmann@t-online.de>2013-01-06 03:42:40 +0100
commit8ffbd6c3789843cb024a3ee425ac4cc0482eaeb7 (patch)
tree6c6ca803e1f6460f114720bf8473efea0f87087f /src/qt/qtipcserver.cpp
parent1f4fdb70f0c5791a4742aa8f59fc42cff9740cfc (diff)
downloadbitcoin-8ffbd6c3789843cb024a3ee425ac4cc0482eaeb7.tar.xz
Bitcoin-Qt: give testnet a unique IPC message queue name
- this prevents an interference with the IPC message queue (which is used for URI processing) when running a testnet and mainnet instance in parallel - to check for testnet, I had to raise the ParseParameters() call in main() to the topmost position
Diffstat (limited to 'src/qt/qtipcserver.cpp')
-rw-r--r--src/qt/qtipcserver.cpp15
1 files changed, 9 insertions, 6 deletions
diff --git a/src/qt/qtipcserver.cpp b/src/qt/qtipcserver.cpp
index b26c37581c..2777fab852 100644
--- a/src/qt/qtipcserver.cpp
+++ b/src/qt/qtipcserver.cpp
@@ -26,6 +26,9 @@ using namespace boost;
using namespace boost::interprocess;
using namespace boost::posix_time;
+// holds Bitcoin-Qt message queue name (initialized in bitcoin.cpp)
+std::string strBitcoinURIQueueName;
+
#if defined MAC_OSX || defined __FreeBSD__
// URI handling not implemented on OSX yet
@@ -46,7 +49,7 @@ static bool ipcScanCmd(int argc, char *argv[], bool fRelay)
{
const char *strURI = argv[i];
try {
- boost::interprocess::message_queue mq(boost::interprocess::open_only, BITCOINURI_QUEUE_NAME);
+ boost::interprocess::message_queue mq(boost::interprocess::open_only, strBitcoinURIQueueName.c_str());
if (mq.try_send(strURI, strlen(strURI), 0))
fSent = true;
else if (fRelay)
@@ -76,7 +79,7 @@ static void ipcThread(void* pArg)
{
// Make this thread recognisable as the GUI-IPC thread
RenameThread("bitcoin-gui-ipc");
-
+
try
{
ipcThread2(pArg);
@@ -112,7 +115,7 @@ static void ipcThread2(void* pArg)
}
// Remove message queue
- message_queue::remove(BITCOINURI_QUEUE_NAME);
+ message_queue::remove(strBitcoinURIQueueName.c_str());
// Cleanup allocated memory
delete mq;
}
@@ -125,7 +128,7 @@ void ipcInit(int argc, char *argv[])
unsigned int nPriority = 0;
try {
- mq = new message_queue(open_or_create, BITCOINURI_QUEUE_NAME, 2, MAX_URI_LENGTH);
+ mq = new message_queue(open_or_create, strBitcoinURIQueueName.c_str(), 2, MAX_URI_LENGTH);
// Make sure we don't lose any bitcoin: URIs
for (int i = 0; i < 2; i++)
@@ -140,10 +143,10 @@ void ipcInit(int argc, char *argv[])
}
// Make sure only one bitcoin instance is listening
- message_queue::remove(BITCOINURI_QUEUE_NAME);
+ message_queue::remove(strBitcoinURIQueueName.c_str());
delete mq;
- mq = new message_queue(open_or_create, BITCOINURI_QUEUE_NAME, 2, MAX_URI_LENGTH);
+ mq = new message_queue(open_or_create, strBitcoinURIQueueName.c_str(), 2, MAX_URI_LENGTH);
}
catch (interprocess_exception &ex) {
printf("ipcInit() - boost interprocess exception #%d: %s\n", ex.get_error_code(), ex.what());