mirror of
https://github.com/meshcore-dev/MeshCore.git
synced 2026-04-25 11:02:15 +00:00
* bug fix
This commit is contained in:
@@ -414,7 +414,7 @@ bool MyMesh::isLooped(const mesh::Packet* packet, const uint8_t max_counters[])
|
||||
}
|
||||
|
||||
void MyMesh::sendFloodReply(mesh::Packet* packet, unsigned long delay_millis, uint8_t path_hash_size) {
|
||||
if (recv_pkt_region) { // if _request_ packet scope is known, send reply with same scope
|
||||
if (recv_pkt_region && !recv_pkt_region->isWildcard()) { // if _request_ packet scope is known, send reply with same scope
|
||||
TransportKey scope;
|
||||
if (region_map.getTransportKeysFor(*recv_pkt_region, &scope, 1) > 0) {
|
||||
sendFloodScoped(scope, packet, delay_millis, path_hash_size);
|
||||
|
||||
@@ -716,7 +716,7 @@ void MyMesh::sendFloodScoped(const TransportKey& scope, mesh::Packet* pkt, uint3
|
||||
}
|
||||
|
||||
void MyMesh::sendFloodReply(mesh::Packet* packet, unsigned long delay_millis, uint8_t path_hash_size) {
|
||||
if (recv_pkt_region) { // if _request_ packet scope is known, send reply with same scope
|
||||
if (recv_pkt_region && !recv_pkt_region->isWildcard()) { // if _request_ packet scope is known, send reply with same scope
|
||||
TransportKey scope;
|
||||
if (region_map.getTransportKeysFor(*recv_pkt_region, &scope, 1) > 0) {
|
||||
sendFloodScoped(scope, packet, delay_millis, path_hash_size);
|
||||
|
||||
@@ -948,12 +948,14 @@ void CommonCLI::handleRegionCmd(char* command, char* reply) {
|
||||
if (strcmp(parts[2], "<null>") == 0) {
|
||||
_region_map->setDefaultRegion(NULL);
|
||||
_callbacks->onDefaultRegionChanged(NULL);
|
||||
_callbacks->saveRegions(); // persist in one atomic step
|
||||
sprintf(reply, " default scope is now <null>");
|
||||
} else {
|
||||
auto def = _region_map->findByNamePrefix(parts[2]);
|
||||
if (def) {
|
||||
_region_map->setDefaultRegion(def);
|
||||
_callbacks->onDefaultRegionChanged(def);
|
||||
_callbacks->saveRegions(); // persist in one atomic step
|
||||
sprintf(reply, " default scope is now %s", def->name);
|
||||
} else {
|
||||
strcpy(reply, "Err - unknown region");
|
||||
|
||||
@@ -16,6 +16,8 @@ struct RegionEntry {
|
||||
uint16_t parent;
|
||||
uint8_t flags;
|
||||
char name[31];
|
||||
|
||||
bool isWildcard() const { return id == 0; }
|
||||
};
|
||||
|
||||
class RegionMap {
|
||||
|
||||
Reference in New Issue
Block a user