1
0
Fork 0
mirror of https://github.com/ton-blockchain/ton synced 2025-03-09 15:40:10 +00:00

Send AdnlMessageNop instead empty Buffer for reverse pings

This commit modifies send_message_ex to use AdnlMessageNop for empty payloads instead of AdnlMessageCustom. This change prevents exceptions in ADNL node implementations that expect non-empty messages, particularly addressing issues with reverse-ping operations from DHT nodes. Using AdnlMessageNop ensures proper handling of empty messages
This commit is contained in:
Andrey Pfau 2024-06-08 20:57:49 +04:00 committed by GitHub
parent 7841d751c0
commit e48bfb7ed3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -55,6 +55,10 @@ class AdnlPeerTableImpl : public AdnlPeerTable {
VLOG(ADNL_WARNING) << "DUMP: " << td::buffer_to_hex(data.as_slice().truncate(128));
return;
}
if (data.empty()) {
send_message_in(src, dst, AdnlMessage{adnlmessage::AdnlMessageNop()}, flags);
return;
}
send_message_in(src, dst, AdnlMessage{adnlmessage::AdnlMessageCustom{std::move(data)}}, flags);
}
void answer_query(AdnlNodeIdShort src, AdnlNodeIdShort dst, AdnlQueryId query_id, td::BufferSlice data) override;