Ferreteria/v0.6/clade/IO/Aspect/Connx/Runner/Local/Proc/@removed
Jump to navigation
Jump to search
|
Removed Code
|
2026-03-03
Finally commented this out to see if it was being used, and the answer seems to be "no". I think it's no longer compatible with how things work. Originally noted on 2026-01-19 that "I don't *think* this is currently used/called; TODO: tidy up or implement as needed":
#
public function OnCheck() {
$oScrn = self::Screen();
$ofLogIO = self::LogFile()->InOut();
$oaPipes = $this->OAPipes();
$qrDestPipe = $oaPipes->DestStream(); // where we are sending the data
$qrErrsPipe = $oaPipes->ErrsStream(); // errors from the receiver
$qrSrcePipe = $oaPipes->SrceStream(); // non-error responses from receiver
// Check for possible response from receiver:
$isErr = $qrErrsPipe->PullBytes();
if (is_string($isErr) && ($isErr !== '')) {
$sMsg = $ok; // $ok is received text
$nlMsg = strlen($sMsg);
if ($nlMsg > 64) {
$ftMsg = '"'.substr($sMsg,32).'"'." ($nlMsg chars total)";
} else {
$ftMsg = $sMsg;
}
echo CRLF.$oScrn->ErrorIt('Received Error Message').': '.$ftMsg.CRLF;
$ofLogIO->WriteEntry("++++ RECEIVED ERROR ++++");
$ofLogIO->WriteEntry($ftMsg);
$ofLogIO->WriteEntry("==== BYTES ERRORED ON:");
$ofLogIO->WriteEntry($sPiece);
$ofLogIO->WriteEntry("==== STATS:");
$ofLogIO->WriteEntry("TRIED = [$nlTried] / SENT = [$nlDone]");
$ofLogIO->WriteEntry("---- RECEIVED ERROR ----");
// TODO: this needs to be checked by the sender, somehow, because it's target-specific
if (str_contains($sMsg,'Unknown command')) {
$doSendLoop = FALSE;
echo $oScrn->ErrorIt('Stopping').' due to parsing error on remote.'.CRLF;
}
}
$isReply = $qrDestPipe->PullBytes();
if (is_string($isReply)) {
$sMsg = $ok; // $ok is received text
echo CRLF.$oScrn->InfoIt('Received Reply Message').': '.$sMsg.CRLF;
$ofLogIO->WriteEntry("==== REPLY MESSAGE: $sMsg");
}
}
Renamed this to DoCommandV1() on 2026-02-27, effectively commenting it out, after making a copy to retrofit for using Canal:
#
// 2026-02-27 code *before* starting to adapt for Canal usage
public function DoCommand(CLineIface $o) : OpCmdIface {
#echo $this->WhoCalledMe();
$this->OCommand($o);
$oActOpen = $this->Open();
$oOpCmd = $this->OOpCmd();
$oOpCmd->Clear();
$ofLogIO = self::LogFile()->InOut();
$qoAud = $o->QOListener();
$doOBuff = $qoAud->HasIt();
if ($doOBuff) $oAud = $qoAud->GetIt();
$sData = NULL;
$this->OnBefore();
if ($oActOpen->GetOkay()) {
$rProc = $this->rProc;
$oSrce = $this->OAPipes()->SrceStream();
// 2026-02-22 Maybe if !$doOBuff, we should QOListener()->SetIt(...something...)
$doLoop = $o->DoWait();
while ($doLoop) {
$oStat = $this->Status();
$isGoing = $oStat->IsRunning();
if ($isGoing) {
$oRes = $oSrce->PullBytes(self::IBUFF_SIZE);
$qoData = $oRes->QData();
if ($qoData->HasIt()) {
$sRecd = $qoData->GetIt();
if ($doOBuff) {
$oOpPush = $oAud->PushBytes($sRecd);
$oOpCmd->Assimilate($oOpPush);
} else {
$sData .= $sRecd;
}
$ofLogIO->WriteEntry("RECD: [$sRecd]");
} // 2026-02-23 Do we need to do anything if bytes *not* received?
$this->OnChange();
}
$doLoop = $isGoing;
}
}
$this->OnAfter();
$oStat = $this->Status();
$this->Shut();
$ok = $oStat->RanOkay();
$nCode = $oStat->ExitCode();
#$this->AmHere("OK=[$ok] RUNNING=[".$oStat->IsRunning()."] CODE=[$nCode] CODE !== 0? [".($nCode !== 0).']');
$oActProc = $this->OOpCmd();
$oActProc->QData()->SetItNz($sData);
#$this->AmHere('COMMAND: '.$o->AsString());
#$this->AmHere("ok=[$ok] doOBuff=[$doOBuff] sData type: ".$this->DiagnoseValue($sData));
$oActProc->Assimilate($oActComm); // TODO 2026-02-22 review this logic. Maybe CopyFrom() instead?
$oActProc->SetOkay($ok);
#$this->AmHere("oActProc:".CRLF.$oActProc->VIEW_AsBlock());
return $oActProc;
}