Esempio n. 1
0
BtsApiNotifier *BtsApi::shutdown()
{
	QUrl apiUrl = getApiUrl(p, "shutdown");

	QNetworkReply *reply = p->nam->get(QNetworkRequest(apiUrl));
	BtsApiNotifier *notifier = new BtsApiNotifier(this);

	connect(reply, &QNetworkReply::finished, [this, reply, notifier]()
	{
		notifier->deleteLater();

		if(checkForError(reply, notifier))
			return;

		QJsonDocument doc = QJsonDocument::fromJson(reply->readAll());

		if(checkForError(doc, notifier))
			return;

		emit shutdownResult();
		emit notifier->shutdownResult();
	});

	return notifier;
}
void CryptobullionCore::shutdown()
{
    try
    {
        printf("Running Shutdown in thread\n");
        threadGroup.interrupt_all();
        threadGroup.join_all();
        Shutdown(0);
        printf("Shutdown finished\n");
        emit shutdownResult(1);
    } catch (std::exception& e) {
        handleRunawayException(&e);
    } catch (...) {
        handleRunawayException(NULL);
    }
}