|
44 | 44 | from lib.core.settings import INFERENCE_GREATER_CHAR |
45 | 45 | from lib.core.settings import INFERENCE_EQUALS_CHAR |
46 | 46 | from lib.core.settings import INFERENCE_NOT_EQUALS_CHAR |
| 47 | +from lib.core.settings import MAX_TIME_REVALIDATION_STEPS |
47 | 48 | from lib.core.settings import PYVERSION |
48 | 49 | from lib.core.threads import getCurrentThreadData |
49 | 50 | from lib.core.threads import runThreads |
@@ -259,16 +260,23 @@ def getChar(idx, charTbl=asciiTbl, continuousOrder=True, expand=charsetType is N |
259 | 260 | errMsg = "invalid character detected. retrying.." |
260 | 261 | logger.error(errMsg) |
261 | 262 |
|
| 263 | + if not kb.originalTimeDelay: |
| 264 | + kb.originalTimeDelay = conf.timeSec |
| 265 | + |
262 | 266 | conf.timeSec += 1 |
263 | | - warnMsg = "increasing time delay to %d second%s " % (conf.timeSec, 's' if conf.timeSec > 1 else '') |
264 | | - warnMsg += "(due to invalid char)" |
265 | | - logger.warn(warnMsg) |
266 | | - |
267 | | - if kb.adjustTimeDelay: |
268 | | - dbgMsg = "turning off auto-adjustment mechanism" |
269 | | - logger.debug(dbgMsg) |
270 | | - kb.adjustTimeDelay = False |
271 | | - return getChar(idx, originalTbl, continuousOrder, expand) |
| 267 | + if (conf.timeSec - kb.originalTimeDelay) <= MAX_TIME_REVALIDATION_STEPS: |
| 268 | + warnMsg = "increasing time delay to %d second%s " % (conf.timeSec, 's' if conf.timeSec > 1 else '') |
| 269 | + warnMsg += "(due to invalid char)" |
| 270 | + logger.warn(warnMsg) |
| 271 | + |
| 272 | + if kb.adjustTimeDelay: |
| 273 | + dbgMsg = "turning off auto-adjustment mechanism" |
| 274 | + logger.debug(dbgMsg) |
| 275 | + kb.adjustTimeDelay = False |
| 276 | + return getChar(idx, originalTbl, continuousOrder, expand) |
| 277 | + else: |
| 278 | + conf.timeSec = kb.originalTimeDelay |
| 279 | + return None |
272 | 280 | else: |
273 | 281 | return decodeIntToUnicode(retVal) |
274 | 282 | else: |
|
0 commit comments