|
|
|
@ -350,7 +350,7 @@ void MyMesh::onDiscoveredContact(ContactInfo &contact, bool is_new, uint8_t path |
|
|
|
} |
|
|
|
|
|
|
|
// add inbound-path to mem cache
|
|
|
|
if (path && path_len <= sizeof(AdvertPath::path)) { // check path is valid
|
|
|
|
if (path && mesh::Packet::isValidPathLen(path_len)) { // check path is valid
|
|
|
|
AdvertPath* p = advert_paths; |
|
|
|
uint32_t oldest = 0xFFFFFFFF; |
|
|
|
for (int i = 0; i < ADVERT_PATH_TABLE_SIZE; i++) { // check if already in table, otherwise evict oldest
|
|
|
|
@ -367,8 +367,7 @@ void MyMesh::onDiscoveredContact(ContactInfo &contact, bool is_new, uint8_t path |
|
|
|
memcpy(p->pubkey_prefix, contact.id.pub_key, sizeof(p->pubkey_prefix)); |
|
|
|
strcpy(p->name, contact.name); |
|
|
|
p->recv_timestamp = getRTCClock()->getCurrentTime(); |
|
|
|
p->path_len = path_len; |
|
|
|
memcpy(p->path, path, p->path_len); |
|
|
|
p->path_len = mesh::Packet::copyPath(p->path, path, path_len); |
|
|
|
} |
|
|
|
|
|
|
|
if (!is_new) dirty_contacts_expiry = futureMillis(LAZY_CONTACTS_WRITE_DELAY); // only schedule lazy write for contacts that are in contacts[]
|
|
|
|
@ -1696,11 +1695,12 @@ void MyMesh::handleCmdFrame(size_t len) { |
|
|
|
} |
|
|
|
} |
|
|
|
if (found) { |
|
|
|
out_frame[0] = RESP_CODE_ADVERT_PATH; |
|
|
|
memcpy(&out_frame[1], &found->recv_timestamp, 4); |
|
|
|
out_frame[5] = found->path_len; |
|
|
|
memcpy(&out_frame[6], found->path, found->path_len); |
|
|
|
_serial->writeFrame(out_frame, 6 + found->path_len); |
|
|
|
int i = 0; |
|
|
|
out_frame[i++] = RESP_CODE_ADVERT_PATH; |
|
|
|
memcpy(&out_frame[i], &found->recv_timestamp, 4); i += 4; |
|
|
|
out_frame[i++] = found->path_len; |
|
|
|
i += mesh::Packet::writePath(&out_frame[i], found->path, found->path_len); |
|
|
|
_serial->writeFrame(out_frame, i); |
|
|
|
} else { |
|
|
|
writeErrFrame(ERR_CODE_NOT_FOUND); |
|
|
|
} |
|
|
|
|