fix ledger update

This commit is contained in:
lnk
2025-08-20 20:32:17 +08:00
parent 78f95f2c96
commit e2ee8546c7
5 changed files with 41 additions and 16 deletions

View File

@@ -5427,10 +5427,12 @@ int update_one_terminal_ledger(terminal* update, int i,ied_t* ied,int terminal_i
if (update[i].addr_str != NULL) {
ied->channel[0].addr = ntohl(inet_addr(update[i].addr_str)); // DEV_IP
strncpy(ied->channel[0].addr_str, update[i].addr_str, LONGNAME - 1); // DEV_IP
ied->channel[0].addr_str[LONGNAME-1] = '\0';
printf("ied_usr->addr_str: %s\n", ied->channel[0].addr_str);
} else {
ied->channel[0].addr = ntohl(inet_addr("0.0.0.0")); // DEV_IP
strncpy(ied->channel[0].addr_str, update[i].addr_str, LONGNAME - 1); // DEV_IP
strncpy(ied->channel[0].addr_str, "0.0.0.0", LONGNAME - 1); // DEV_IP
ied->channel[0].addr_str[LONGNAME-1] = '\0';
printf("ied_usr->addr_str: %s\n", ied->channel[0].addr_str);
}
if (update[i].port != NULL) {
@@ -6194,7 +6196,7 @@ void clear_channel_and_cpuinfo(byte_t chncount, channel_t *channel, byte_t cpuco
memset(channel[i].addr_str, 0, LONGNAME);
channel[i].addr = 0;
channel[i].port = 0;
channel[i].status = 0;
channel[i].status = CHANNEL_DISCONNECTED;
channel[i].last_ticks = 0;
channel[i].last_send_ticks = 0;
channel[i].ied_id = 0;