minisatip
minisatip copied to clipboard
[BUG] Key expirity value generates troubles
Hi @catalinii ,
A lot time I've asked about the expirity time of the key, because I see some errors related to this. And now I feel I've discovered the problem.
Please check this line, and try to explain why you use it: https://github.com/catalinii/minisatip/blob/fc3d73feffa25786098be2cc55986eb9ff080629/src/pmt.c#L689
What's the problem? We have in the list of "valid" keys some recent keys, but you're enforcing to not check them because you feel that they are expired. But the expiration time is very short. And sometimes in the log you can see something like this:
[26/06 14:09:51.934 AD0]: Parity change for TEST-SVR PMT 1, new active parity 1 pid 239 [47 11 77 C2 31 6E CB]
[26/06 14:09:51.935 AD0]: found CW: 3 for TEST-SVR PMT 1, old cw 2, packets 18, parity 1, pid 1032: id 3, parity 1, pmt 1, time 13035 ms ago, expiry in 11965 ms, CW: AA BB CC DD EE FF 00 11
[26/06 14:09:51.938 AD0]: Parity change for TEST-SVR PMT 1, new active parity 0 pid 238 [47 40 76 96 45 15 28]
[26/06 14:09:51.938 AD0]: found CW: -1 for TEST-SVR PMT 1, old cw 3, packets 11, parity 0, pid 1032: not found
[26/06 14:09:51.938 AD0]: Parity change for TEST-SVR PMT 1, new active parity 1 pid 238 [47 11 76 C2 22 B9 35]
[26/06 14:09:51.939 AD0]: found CW: 3 for TEST-SVR PMT 1, old cw -1, packets 18, parity 1, pid 1032: id 3, parity 1, pmt 1, time 13039 ms ago, expiry in 11961 ms, CW: AA BB CC DD EE FF 00 11
Here you can see that the search loop don't found any key (CW: -1). And the reason is because the previous "CW: 2" that corresponds to the match key for parity 0 (see the old cw 2 in the first found CW: 3) is discarded only becuase the expirity time.
Plese, can you fix this? Perhaps with something like:
if (ctime > cws[i]->expiry + 10000)
continue;
Regards.
Hi @catalinii ,
I prepared a PR with a fix: #867 . Please, try it! Regards.
This is resolved with the commit https://github.com/catalinii/minisatip/commit/04b6241669b114b2d0a04f359656cac956ef37d4 , so I close it.