Skip to content

Commit 81c2caa

Browse files
committed
Zabranit preteceni ping_next_id.
1 parent 077c50d commit 81c2caa

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/TCPORsRef.pas

+7-1
Original file line numberDiff line numberDiff line change
@@ -213,11 +213,17 @@ procedure TTCPORsRef.CheckSendPing(AContext:TIdContext);
213213
begin
214214
ORTCPServer.SendLn(AContext, '-;PING;REQ-RESP;'+IntToStr(Self.ping_next_id));
215215
Self.ping_sent.Enqueue(ORPing(Self.ping_next_id, Now));
216+
216217
if (Self.regulator_loks.Count > 0) then
217218
Self.ping_next_send := Now+EncodeTime(0, 0, _PING_PERIOD_REG, 0)
218219
else
219220
Self.ping_next_send := Now+EncodeTime(0, 0, _PING_PERIOD_NOREG, 0);
220-
Self.ping_next_id := Self.ping_next_id + 1;
221+
222+
if (Self.ping_next_id < High(Cardinal)) then
223+
Self.ping_next_id := Self.ping_next_id + 1
224+
else
225+
Self.ping_next_id := 0;
226+
221227
if (Self.ping_unreachable) then
222228
Self.ping_sent.Dequeue(); // do not fill queue with inifinite amount of data
223229
end;

0 commit comments

Comments
 (0)