MCPcopy Create free account
hub / github.com/bitcoin/bitcoin / ipcSendCommandLine

Method ipcSendCommandLine

src/qt/paymentserver.cpp:92–123  ·  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

90// when uiReady() is called.
91//
92bool 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
125PaymentServer::PaymentServer(QObject* parent, bool startLocalServer)
126 : QObject(parent)

Callers

nothing calls this directly

Calls 4

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

Tested by

no test coverage detected