Skip to content

Commit c61fde9

Browse files
committed
always send PUSH_CODE_NEW_ADVERT when advert was not added to contacts[]
1 parent 7d1f522 commit c61fde9

File tree

2 files changed

+2
-3
lines changed

2 files changed

+2
-3
lines changed

examples/companion_radio/MyMesh.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,7 @@ void MyMesh::onContactsFull() {
323323

324324
void MyMesh::onDiscoveredContact(ContactInfo &contact, bool is_new, uint8_t path_len, const uint8_t* path) {
325325
if (_serial->isConnected()) {
326-
if (!shouldAutoAddContactType(contact.type) && is_new) {
326+
if (is_new) {
327327
writeContactRespFrame(PUSH_CODE_NEW_ADVERT, contact);
328328
} else {
329329
out_frame[0] = PUSH_CODE_ADVERT;

src/helpers/BaseChatMesh.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ void BaseChatMesh::onAdvertRecv(mesh::Packet* packet, const mesh::Identity& id,
133133
}
134134
putBlobByKey(id.pub_key, PUB_KEY_SIZE, temp_buf, plen);
135135

136-
bool is_new = false;
136+
bool is_new = false; // true = not in contacts[], false = exists in contacts[]
137137
if (from == NULL) {
138138
if (!shouldAutoAddContactType(parser.getType())) {
139139
ContactInfo ci;
@@ -142,7 +142,6 @@ void BaseChatMesh::onAdvertRecv(mesh::Packet* packet, const mesh::Identity& id,
142142
return;
143143
}
144144

145-
is_new = true;
146145
from = allocateContactSlot();
147146
if (from == NULL) {
148147
ContactInfo ci;

0 commit comments

Comments
 (0)