Skip to content

Commit ffcc171

Browse files
committed
Improve log message spelling.
1 parent 47724bd commit ffcc171

8 files changed

Lines changed: 28 additions & 33 deletions

File tree

‎benchmark/bench_misc.cpp‎

Lines changed: 14 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -421,13 +421,12 @@ class IdDuplicateCheckerOld {
421421
if (saved_message_ids_.size() == MAX_SAVED_MESSAGE_IDS) {
422422
auto oldest_message_id = *saved_message_ids_.begin();
423423
if (message_id < oldest_message_id) {
424-
return td::Status::Error(2, PSLICE() << "Ignore very old message_id "
425-
<< td::tag("oldest message_id", oldest_message_id)
426-
<< td::tag("got message_id", message_id));
424+
return td::Status::Error(2, PSLICE() << "Ignore very old message " << message_id
425+
<< " older than the oldest known message " << oldest_message_id);
427426
}
428427
}
429428
if (saved_message_ids_.count(message_id) != 0) {
430-
return td::Status::Error(1, PSLICE() << "Ignore duplicated message_id " << td::tag("message_id", message_id));
429+
return td::Status::Error(1, PSLICE() << "Ignore already processed message " << message_id);
431430
}
432431

433432
saved_message_ids_.insert(message_id);
@@ -451,16 +450,15 @@ class IdDuplicateCheckerNew {
451450
td::Status check(td::int64 message_id) {
452451
auto insert_result = saved_message_ids_.insert(message_id);
453452
if (!insert_result.second) {
454-
return td::Status::Error(1, PSLICE() << "Ignore duplicated message_id " << td::tag("message_id", message_id));
453+
return td::Status::Error(1, PSLICE() << "Ignore already processed message " << message_id);
455454
}
456455
if (saved_message_ids_.size() == MAX_SAVED_MESSAGE_IDS + 1) {
457456
auto begin_it = saved_message_ids_.begin();
458457
bool is_very_old = begin_it == insert_result.first;
459458
saved_message_ids_.erase(begin_it);
460459
if (is_very_old) {
461-
return td::Status::Error(2, PSLICE() << "Ignore very old message_id "
462-
<< td::tag("oldest message_id", *saved_message_ids_.begin())
463-
<< td::tag("got message_id", message_id));
460+
return td::Status::Error(2, PSLICE() << "Ignore very old message " << message_id
461+
<< " older than the oldest known message " << *saved_message_ids_.begin());
464462
}
465463
}
466464
return td::Status::OK();
@@ -477,16 +475,15 @@ class IdDuplicateCheckerNewOther {
477475
}
478476
td::Status check(td::int64 message_id) {
479477
if (!saved_message_ids_.insert(message_id).second) {
480-
return td::Status::Error(1, PSLICE() << "Ignore duplicated message_id " << td::tag("message_id", message_id));
478+
return td::Status::Error(1, PSLICE() << "Ignore already processed message " << message_id);
481479
}
482480
if (saved_message_ids_.size() == MAX_SAVED_MESSAGE_IDS + 1) {
483481
auto begin_it = saved_message_ids_.begin();
484482
bool is_very_old = *begin_it == message_id;
485483
saved_message_ids_.erase(begin_it);
486484
if (is_very_old) {
487-
return td::Status::Error(2, PSLICE() << "Ignore very old message_id "
488-
<< td::tag("oldest message_id", *saved_message_ids_.begin())
489-
<< td::tag("got message_id", message_id));
485+
return td::Status::Error(2, PSLICE() << "Ignore very old message " << message_id
486+
<< " older than the oldest known message " << *saved_message_ids_.begin());
490487
}
491488
}
492489
return td::Status::OK();
@@ -505,14 +502,14 @@ class IdDuplicateCheckerNewSimple {
505502
td::Status check(td::int64 message_id) {
506503
auto insert_result = saved_message_ids_.insert(message_id);
507504
if (!insert_result.second) {
508-
return td::Status::Error(1, "Ignore duplicated message_id");
505+
return td::Status::Error(1, "Ignore already processed message");
509506
}
510507
if (saved_message_ids_.size() == MAX_SAVED_MESSAGE_IDS + 1) {
511508
auto begin_it = saved_message_ids_.begin();
512509
bool is_very_old = begin_it == insert_result.first;
513510
saved_message_ids_.erase(begin_it);
514511
if (is_very_old) {
515-
return td::Status::Error(2, "Ignore very old message_id");
512+
return td::Status::Error(2, "Ignore very old message");
516513
}
517514
}
518515
return td::Status::OK();
@@ -540,13 +537,12 @@ class IdDuplicateCheckerArray {
540537
return td::Status::OK();
541538
}
542539
if (end_pos_ >= max_size && message_id < saved_message_ids_[0]) {
543-
return td::Status::Error(2, PSLICE() << "Ignore very old message_id "
544-
<< td::tag("oldest message_id", saved_message_ids_[0])
545-
<< td::tag("got message_id", message_id));
540+
return td::Status::Error(2, PSLICE() << "Ignore very old message " << message_id
541+
<< " older than the oldest known message " << saved_message_ids_[0]);
546542
}
547543
auto it = std::lower_bound(&saved_message_ids_[0], &saved_message_ids_[end_pos_], message_id);
548544
if (*it == message_id) {
549-
return td::Status::Error(1, PSLICE() << "Ignore duplicated message_id " << td::tag("message_id", message_id));
545+
return td::Status::Error(1, PSLICE() << "Ignore already processed message " << message_id);
550546
}
551547
std::copy_backward(it, &saved_message_ids_[end_pos_], &saved_message_ids_[end_pos_ + 1]);
552548
*it = message_id;

‎td/mtproto/AuthData.cpp‎

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,12 @@ Status check_message_id_duplicates(int64 *saved_message_ids, size_t max_size, si
3232
return Status::OK();
3333
}
3434
if (end_pos >= max_size && message_id < saved_message_ids[0]) {
35-
return Status::Error(2, PSLICE() << "Ignore very old message_id " << tag("oldest message_id", saved_message_ids[0])
36-
<< tag("got message_id", message_id));
35+
return Status::Error(2, PSLICE() << "Ignore very old message " << message_id
36+
<< " older than the oldest known message " << saved_message_ids[0]);
3737
}
3838
auto it = std::lower_bound(&saved_message_ids[0], &saved_message_ids[end_pos], message_id);
3939
if (*it == message_id) {
40-
return Status::Error(1, PSLICE() << "Ignore duplicated message_id " << tag("message_id", message_id));
40+
return Status::Error(1, PSLICE() << "Ignore already processed message " << message_id);
4141
}
4242
std::copy_backward(it, &saved_message_ids[end_pos], &saved_message_ids[end_pos + 1]);
4343
*it = message_id;
@@ -133,14 +133,14 @@ Status AuthData::check_packet(int64 session_id, int64 message_id, double now, bo
133133
// Client is to check that the session_id field in the decrypted message indeed equals to that of an active session
134134
// created by the client.
135135
if (get_session_id() != static_cast<uint64>(session_id)) {
136-
return Status::Error(PSLICE() << "Got packet from different session " << tag("current session_id", get_session_id())
137-
<< tag("got session_id", session_id));
136+
return Status::Error(PSLICE() << "Receive packet from different session " << session_id << " in session "
137+
<< get_session_id());
138138
}
139139

140140
// Client must check that msg_id has even parity for messages from client to server, and odd parity for messages
141141
// from server to client.
142142
if ((message_id & 1) == 0) {
143-
return Status::Error(PSLICE() << "Got invalid message_id " << tag("message_id", message_id));
143+
return Status::Error(PSLICE() << "Receive invalid message identifier " << message_id);
144144
}
145145

146146
TRY_STATUS(duplicate_checker_.check(message_id));
@@ -152,8 +152,7 @@ Status AuthData::check_packet(int64 session_id, int64 message_id, double now, bo
152152
// The client would also find this useful (to protect from a replay attack), but only if it is certain of its time
153153
// (for example, if its time has been synchronized with that of the server).
154154
if (server_time_difference_was_updated_ && !is_valid_inbound_msg_id(message_id, now)) {
155-
return Status::Error(PSLICE() << "Ignore message with too old or too new message_id "
156-
<< tag("message_id", message_id));
155+
return Status::Error(PSLICE() << "Ignore too old or too new message " << message_id);
157156
}
158157

159158
return Status::OK();

‎td/mtproto/SessionConnection.cpp‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ namespace mtproto {
8989
*
9090
* 6. New session creation
9191
* A notification about new session.
92-
* It is reasonable to store unique_id with current session, in order to process duplicated notifications once.
92+
* It is reasonable to store unique_id with current session in order to process duplicated notifications only once.
9393
*
9494
* Causes all messages older than first_msg_id to be re-sent and notifies about a gap in updates
9595
* output:
@@ -849,7 +849,7 @@ void SessionConnection::send_ack(uint64 message_id) {
849849
send_before(Time::now_cached() + ACK_DELAY);
850850
}
851851
auto ack = static_cast<int64>(message_id);
852-
// an easiest way to eliminate duplicated acks for gzipped packets
852+
// an easiest way to eliminate duplicated acknowledgements for gzipped packets
853853
if (to_ack_.empty() || to_ack_.back() != ack) {
854854
to_ack_.push_back(ack);
855855

‎td/telegram/AuthManager.cpp‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -941,7 +941,7 @@ void AuthManager::on_delete_account_result(NetQueryPtr &result) {
941941

942942
void AuthManager::on_get_authorization(tl_object_ptr<telegram_api::auth_Authorization> auth_ptr) {
943943
if (state_ == State::Ok) {
944-
LOG(WARNING) << "Ignore duplicated auth.Authorization";
944+
LOG(WARNING) << "Ignore duplicate auth.Authorization";
945945
if (query_id_ != 0) {
946946
on_query_ok();
947947
}

‎td/telegram/MessagesManager.cpp‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16442,7 +16442,7 @@ void MessagesManager::add_notification_id_to_message_id_correspondence(Dialog *d
1644216442
<< d->dialog_id;
1644316443
d->notification_id_to_message_id.emplace(notification_id, message_id);
1644416444
} else if (it->second != message_id) {
16445-
LOG(ERROR) << "Have duplicated " << notification_id << " in " << d->dialog_id << " in " << message_id << " and "
16445+
LOG(ERROR) << "Have the same " << notification_id << " in " << d->dialog_id << " for " << message_id << " and "
1644616446
<< it->second;
1644716447
if (it->second < message_id) {
1644816448
it->second = message_id;

‎td/telegram/NotificationManager.cpp‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1057,7 +1057,7 @@ void NotificationManager::flush_pending_updates(int32 group_id, const char *sour
10571057
if (!removed_notification_ids.insert(notification_id).second) {
10581058
// sometimes there can be deletion of notification without previous addition, because the notification
10591059
// has already been deleted at the time of addition and get_notification_object_type was nullptr
1060-
VLOG(notifications) << "Remove duplicated deletion of " << notification_id;
1060+
VLOG(notifications) << "Remove duplicate deletion of " << notification_id;
10611061
notification_id = 0;
10621062
}
10631063
}

‎tdutils/td/utils/OptionParser.cpp‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ void OptionParser::add_option(Option::Type type, char short_key, Slice long_key,
3838
std::function<Status(Slice)> callback) {
3939
for (auto &option : options_) {
4040
if ((short_key != '\0' && option.short_key == short_key) || (!long_key.empty() && long_key == option.long_key)) {
41-
LOG(ERROR) << "Ignore duplicated option '" << (short_key == '\0' ? '-' : short_key) << "' '" << long_key << "'";
41+
LOG(ERROR) << "Ignore duplicate option '" << (short_key == '\0' ? '-' : short_key) << "' '" << long_key << "'";
4242
}
4343
}
4444
options_.push_back(Option{type, short_key, long_key.str(), description.str(), std::move(callback)});

‎tdutils/td/utils/port/detail/NativeFd.cpp‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ class FdSet {
3636
}
3737
std::unique_lock<std::mutex> guard(mutex_);
3838
if (fds_.count(fd) >= 1) {
39-
LOG(FATAL) << "Create duplicated fd: " << fd;
39+
LOG(FATAL) << "Create duplicate fd: " << fd;
4040
}
4141
fds_.insert(fd);
4242
}

0 commit comments

Comments
 (0)