MCPcopy Create free account
hub / github.com/ElementsProject/elements / ipcSendCommandLine

Method ipcSendCommandLine

src/qt/paymentserver.cpp:117–148  ·  view source on GitHub ↗

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.

Source from the content-addressed store, hash-verified

115// when uiReady() is called.
116//
117bool 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
150PaymentServer::PaymentServer(QObject* parent, bool startLocalServer) :
151 QObject(parent),

Callers

nothing calls this directly

Calls 4

ipcServerNameFunction · 0.85
flushMethod · 0.80
seekMethod · 0.45
writeMethod · 0.45

Tested by

no test coverage detected