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.
| 115 | // when uiReady() is called. |
| 116 | // |
| 117 | bool PaymentServer::ipcSendCommandLine() |
| 118 | { |
| 119 | bool fResult = false; |
| 120 | for (const QString& r : savedPaymentRequests) |
| 121 | { |
| 122 | QLocalSocket* socket = new QLocalSocket(); |
| 123 | socket->connectToServer(ipcServerName(), QIODevice::WriteOnly); |
| 124 | if (!socket->waitForConnected(BITCOIN_IPC_CONNECT_TIMEOUT)) |
| 125 | { |
| 126 | delete socket; |
| 127 | socket = nullptr; |
| 128 | return false; |
| 129 | } |
| 130 | |
| 131 | QByteArray block; |
| 132 | QDataStream out(&block, QIODevice::WriteOnly); |
| 133 | out.setVersion(QDataStream::Qt_4_0); |
| 134 | out << r; |
| 135 | out.device()->seek(0); |
| 136 | |
| 137 | socket->write(block); |
| 138 | socket->flush(); |
| 139 | socket->waitForBytesWritten(BITCOIN_IPC_CONNECT_TIMEOUT); |
| 140 | socket->disconnectFromServer(); |
| 141 | |
| 142 | delete socket; |
| 143 | socket = nullptr; |
| 144 | fResult = true; |
| 145 | } |
| 146 | |
| 147 | return fResult; |
| 148 | } |
| 149 | |
| 150 | PaymentServer::PaymentServer(QObject* parent, bool startLocalServer) : |
| 151 | QObject(parent), |
nothing calls this directly
no test coverage detected