Commit a2a0322f authored by Edric Milaret's avatar Edric Milaret

fix print flag

Change-Id: I870ca4ec094af2ae592c9f990939bcaf01b7e22f
Tuleap: #664
parent 306e1e66
......@@ -121,7 +121,7 @@ MessageEngine::trySend(decltype(MessageEngine::messages_)::iterator m)
RING_WARN("Can't send message in status %d", (int)m->second.status);
return;
}
RING_DBG("Retrying to send message %llu", m->first);
RING_DBG("Retrying to send message %" PRIu64, m->first);
m->second.status = MessageStatus::SENDING;
m->second.retried++;
m->second.last_op = clock::now();
......@@ -135,37 +135,37 @@ MessageEngine::trySend(decltype(MessageEngine::messages_)::iterator m)
void
MessageEngine::onMessageSent(MessageToken token, bool ok)
{
RING_DBG("Message %llu: %s", token, ok ? "success" : "failure");
RING_DBG("Message %" PRIu64 ": %s", token, ok ? "success" : "failure");
std::lock_guard<std::mutex> lock(messagesMutex_);
auto f = messages_.find(token);
if (f != messages_.end()) {
if (f->second.status == MessageStatus::SENDING) {
if (ok) {
f->second.status = MessageStatus::SENT;
RING_DBG("Status SENT for message %llu", token);
RING_DBG("Status SENT for message %" PRIu64, token);
emitSignal<DRing::ConfigurationSignal::AccountMessageStatusChanged>(account_.getAccountID(),
token,
f->second.to,
static_cast<int>(DRing::Account::MessageStates::SENT));
} else if (f->second.retried == MAX_RETRIES) {
f->second.status = MessageStatus::FAILURE;
RING_DBG("Status FAILURE for message %llu", token);
RING_DBG("Status FAILURE for message %" PRIu64, token);
emitSignal<DRing::ConfigurationSignal::AccountMessageStatusChanged>(account_.getAccountID(),
token,
f->second.to,
static_cast<int>(DRing::Account::MessageStates::FAILURE));
} else {
f->second.status = MessageStatus::IDLE;
RING_DBG("Status IDLE for message %llu", token);
RING_DBG("Status IDLE for message %" PRIu64, token);
// TODO: reschedule sending
}
}
else {
RING_DBG("Message %llu not SENDING", token);
RING_DBG("Message %" PRIu64 " not SENDING", token);
}
}
else {
RING_DBG("Can't find message %llu", token);
RING_DBG("Can't find message %" PRIu64, token);
}
}
......
......@@ -26,6 +26,8 @@ extern "C" {
#endif
#include <stdarg.h>
#define __STDC_FORMAT_MACROS 1
#include <inttypes.h>
#define LOGFILE "dring"
......
......@@ -1408,7 +1408,7 @@ Manager::scheduleTask(std::shared_ptr<Runnable> task, std::chrono::steady_clock:
{
std::lock_guard<std::mutex> lock(scheduledTasksMutex_);
scheduledTasks_.emplace(when, task);
RING_DBG("Task scheduled. Next in %llds", std::chrono::duration_cast<std::chrono::seconds>(scheduledTasks_.begin()->first - std::chrono::steady_clock::now()).count());
RING_DBG("Task scheduled. Next in %" PRId64, std::chrono::duration_cast<std::chrono::seconds>(scheduledTasks_.begin()->first - std::chrono::steady_clock::now()).count());
}
// Must be invoked periodically by a timer from the main event loop
......
......@@ -963,7 +963,7 @@ RingAccount::doRegister_()
std::map<std::string, std::string> payloads = {{"text/plain",
utf8_make_valid(v.msg)}};
shared->onTextMessage(from, payloads);
RING_DBG("Sending message confirmation %llu", v.id);
RING_DBG("Sending message confirmation %" PRIu64, v.id);
this_.dht_.putEncrypted(inboxKey,
v.from,
dht::ImMessage(v.id, std::string(), now));
......@@ -1427,18 +1427,18 @@ RingAccount::sendTextMessage(const std::string& to, const std::map<std::string,
return true;
auto e = this_->sentMessages_.find(msg.id);
if (e == this_->sentMessages_.end()) {
RING_DBG("Message not found for %llu", token);
RING_DBG("Message not found for %" PRIu64, token);
}
if (e->second.to != msg.from) {
RING_DBG("Unrelated text message : from %s != second %s",
msg.from.toString().c_str(), e->second.to.toString().c_str());
}
if (e == this_->sentMessages_.end() || e->second.to != msg.from) {
RING_DBG("Unrelated text message reply for %llu", token);
RING_DBG("Unrelated text message reply for %" PRIu64, token);
return true;
}
this_->sentMessages_.erase(e);
RING_DBG("Relevant text message reply for %llu", token);
RING_DBG("Relevant text message reply for %" PRIu64, token);
// add treated message
auto res = this_->treatedMessages_.insert(msg.id);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment