diff --git a/tools/etcpmon/etcpmon_client.c b/tools/etcpmon/etcpmon_client.c index 977a030..dd1177c 100644 --- a/tools/etcpmon/etcpmon_client.c +++ b/tools/etcpmon/etcpmon_client.c @@ -222,6 +222,18 @@ void etcpmon_client_disconnect(struct etcpmon_client* client) { client->fully_connected = 0; client->recv_len = 0; client->selected_peer_id = 0; + + /* Очистить очередь pending requests и сбросить seq_id */ + struct etcpmon_pending_request* req = client->pending_head; + while (req) { + struct etcpmon_pending_request* next = req->next; + free(req); + req = next; + } + client->pending_head = NULL; + client->pending_tail = NULL; + client->next_seq_id = 1; + client->last_response_seq_id = 0; } int etcpmon_client_is_connected(const struct etcpmon_client* client) { diff --git a/tools/etcpmon/etcpmon_gui.c b/tools/etcpmon/etcpmon_gui.c index ddbe773..d657f89 100644 --- a/tools/etcpmon/etcpmon_gui.c +++ b/tools/etcpmon/etcpmon_gui.c @@ -733,6 +733,8 @@ static void OnDisconnect(struct etcpmon_app* app) { etcpmon_client_disconnect(app->client); app->isConnected = 0; + app->need_initial_request = 1; + app->last_selected_peer_id = 0; // Сбросить для автоматического выбора при переподключении UpdateUIState(app); etcpmon_gui_clear_metrics(app); etcpmon_gui_set_status(app, "Disconnected");