26 | | message_queue* mq = (message_queue*)parg; |
27 | | char strBuf[257]; |
28 | | size_t nSize; |
29 | | unsigned int nPriority; |
30 | | loop |
31 | | { |
32 | | ptime d = boost::posix_time::microsec_clock::universal_time() + millisec(100); |
33 | | if(mq->timed_receive(&strBuf, sizeof(strBuf), nSize, nPriority, d)) |
34 | | { |
35 | | ThreadSafeHandleURI(std::string(strBuf, nSize)); |
36 | | Sleep(1000); |
37 | | } |
38 | | if (fShutdown) |
39 | | { |
40 | | ipcShutdown(); |
41 | | break; |
42 | | } |
43 | | } |
44 | | ipcShutdown(); |
| 12 | // message_queue* mq = (message_queue*)parg; |
| 13 | // char strBuf[257]; |
| 14 | // size_t nSize; |
| 15 | // unsigned int nPriority; |
| 16 | // loop |
| 17 | // { |
| 18 | // ptime d = boost::posix_time::microsec_clock::universal_time() + millisec(100); |
| 19 | // if(mq->timed_receive(&strBuf, sizeof(strBuf), nSize, nPriority, d)) |
| 20 | // { |
| 21 | // ThreadSafeHandleURI(std::string(strBuf, nSize)); |
| 22 | // Sleep(1000); |
| 23 | // } |
| 24 | // if (fShutdown) |
| 25 | // { |
| 26 | // ipcShutdown(); |
| 27 | // break; |
| 28 | // } |
| 29 | // } |
| 30 | // ipcShutdown(); |
60 | | message_queue* mq; |
61 | | char strBuf[257]; |
62 | | size_t nSize; |
63 | | unsigned int nPriority; |
64 | | try { |
65 | | mq = new message_queue(open_or_create, BITCOINURI_QUEUE_NAME, 2, 256); |
66 | | |
67 | | // Make sure we don't lose any bitcoin: URIs |
68 | | for (int i = 0; i < 2; i++) |
69 | | { |
70 | | ptime d = boost::posix_time::microsec_clock::universal_time() + millisec(1); |
71 | | if(mq->timed_receive(&strBuf, sizeof(strBuf), nSize, nPriority, d)) |
72 | | { |
73 | | ThreadSafeHandleURI(std::string(strBuf, nSize)); |
74 | | } |
75 | | else |
76 | | break; |
77 | | } |
78 | | |
79 | | // Make sure only one bitcoin instance is listening |
80 | | message_queue::remove(BITCOINURI_QUEUE_NAME); |
81 | | mq = new message_queue(open_or_create, BITCOINURI_QUEUE_NAME, 2, 256); |
82 | | } |
83 | | catch (interprocess_exception &ex) { |
84 | | return; |
85 | | } |
86 | | if (!CreateThread(ipcThread, mq)) |
87 | | { |
88 | | delete mq; |
89 | | } |
| 46 | // message_queue* mq; |
| 47 | // char strBuf[257]; |
| 48 | // size_t nSize; |
| 49 | // unsigned int nPriority; |
| 50 | // try { |
| 51 | // mq = new message_queue(open_or_create, BITCOINURI_QUEUE_NAME, 2, 256); |
| 52 | // |
| 53 | // // Make sure we don't lose any bitcoin: URIs |
| 54 | // for (int i = 0; i < 2; i++) |
| 55 | // { |
| 56 | // ptime d = boost::posix_time::microsec_clock::universal_time() + millisec(1); |
| 57 | // if(mq->timed_receive(&strBuf, sizeof(strBuf), nSize, nPriority, d)) |
| 58 | // { |
| 59 | // ThreadSafeHandleURI(std::string(strBuf, nSize)); |
| 60 | // } |
| 61 | // else |
| 62 | // break; |
| 63 | // } |
| 64 | // |
| 65 | // // Make sure only one bitcoin instance is listening |
| 66 | // message_queue::remove(BITCOINURI_QUEUE_NAME); |
| 67 | // mq = new message_queue(open_or_create, BITCOINURI_QUEUE_NAME, 2, 256); |
| 68 | // } |
| 69 | // catch (interprocess_exception &ex) { |
| 70 | // return; |
| 71 | // } |
| 72 | // if (!CreateThread(ipcThread, mq)) |
| 73 | // { |
| 74 | // delete mq; |
| 75 | // } |