You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
$cmdObj = $ctrlObj->getCmd($strCmd, $regEx, $timeout)->setTimeout(2592000000); //30 day timeout enough?
65
+
66
+
$rValue = null;
67
+
$rType = null;
68
+
$lastHash = "";
69
+
$staticCount = 0; //how many times in the loop have we received no change in the return
70
+
$maxStatic = 10; //how many time can the output hash to the same thing before we consider the transfer stalled?
71
+
$mSleep = 250000; //how many micro secs to sleep each time we are "not done" this + maxStatic makes this more or less responsive (and more or less CPU intensive)
72
+
73
+
$cmdObj->exec();
74
+
while(true) {
75
+
$ctrlObj->read($cmdObj);
76
+
if ($cmdObj->getIsDone() === false) {
77
+
78
+
usleep($mSleep); //dont redline the CPU
79
+
$curHash = hash("sha256", $cmdObj->getData()); //file name, transfer rate lots can change
80
+
if ($curHash != $lastHash) {
81
+
$lastHash = $curHash;
82
+
$staticCount = 0;
83
+
} elseif ($maxStatic > $staticCount) {
84
+
$staticCount++;
85
+
} else {
86
+
$rValue = "Transfer stalled, no change in output. Count: ".$staticCount;
0 commit comments