Sending to the server is done synchronously, at startup. If the server isn't already running, startup continues, and the items in savedPaymentRequest will be handled when uiReady() is called.
| 90 | // when uiReady() is called. |
| 91 | // |
| 92 | bool PaymentServer::ipcSendCommandLine() |
| 93 | { |
| 94 | bool fResult = false; |
| 95 | for (const QString& r : savedPaymentRequests) |
| 96 | { |
| 97 | QLocalSocket* socket = new QLocalSocket(); |
| 98 | socket->connectToServer(ipcServerName(), QIODevice::WriteOnly); |
| 99 | if (!socket->waitForConnected(BITCOIN_IPC_CONNECT_TIMEOUT)) |
| 100 | { |
| 101 | delete socket; |
| 102 | socket = nullptr; |
| 103 | return false; |
| 104 | } |
| 105 | |
| 106 | QByteArray block; |
| 107 | QDataStream out(&block, QIODevice::WriteOnly); |
| 108 | out.setVersion(QDataStream::Qt_4_0); |
| 109 | out << r; |
| 110 | out.device()->seek(0); |
| 111 | |
| 112 | socket->write(block); |
| 113 | socket->flush(); |
| 114 | socket->waitForBytesWritten(BITCOIN_IPC_CONNECT_TIMEOUT); |
| 115 | socket->disconnectFromServer(); |
| 116 | |
| 117 | delete socket; |
| 118 | socket = nullptr; |
| 119 | fResult = true; |
| 120 | } |
| 121 | |
| 122 | return fResult; |
| 123 | } |
| 124 | |
| 125 | PaymentServer::PaymentServer(QObject* parent, bool startLocalServer) |
| 126 | : QObject(parent) |
nothing calls this directly
no test coverage detected