When originating a session, send anything received via the queue

This commit is contained in:
2023-11-22 21:04:58 +11:00
parent 7847728e52
commit e5de4970d1
6 changed files with 27 additions and 17 deletions

View File

@@ -897,7 +897,7 @@ final class Binkp extends BaseProtocol
return TRUE;
}
$this->recv->new($file['file'],$this->node->address);
$this->recv->new($file['file'],$this->node->address,$this->force_queue);
try {
switch ($this->recv->open($file['offs']<0,$file['flags'])) {
@@ -1341,14 +1341,16 @@ final class Binkp extends BaseProtocol
/**
* Set up our BINKP session
*
* @param bool $force_queue
* @return int
* @throws \Exception
*/
protected function protocol_session(): int
protected function protocol_session(bool $force_queue=FALSE): int
{
if ($this->binkp_init() !== self::OK)
return self::S_FAILURE;
$this->force_queue = $force_queue;
$this->binkp_hs();
while (TRUE) {

View File

@@ -99,10 +99,11 @@ final class DNS extends BaseProtocol
* TTL positive values of a signed 32 bit number.
* UDP messages 512 octets or less
*
* @param bool $force_queue Not used here
* @return int
* @throws \Exception
*/
public function protocol_session(): int
public function protocol_session(bool $force_queue=FALSE): int
{
Log::debug(sprintf('%s:+ DNS Query',self::LOGKEY));

View File

@@ -976,11 +976,12 @@ final class EMSI extends BaseProtocol implements CRCInterface,ZmodemInterface
* @return int
* @throws \Exception
*/
protected function protocol_session(): int
protected function protocol_session(bool $force_queue=FALSE): int
{
// @todo introduce emsi_init() to perform the job of protocol_init. Only needs to be done when we originate a session
Log::debug(sprintf('%s:+ Starting EMSI Protocol SESSION',self::LOGKEY));
$this->force_queue = $force_queue;
$was_req = 0;
$got_req = 0;
@@ -1189,7 +1190,7 @@ final class EMSI extends BaseProtocol implements CRCInterface,ZmodemInterface
Log::debug(sprintf('%s:+ Start WAZOO Receive',self::LOGKEY));
// @todo If the node is not defined in the DB node->address is NULL. Need to figure out how to handle those nodes.
$rc = (new Zmodem)->zmodem_receive($this->client,$zap,$this->recv,$this->node->address);
$rc = (new Zmodem)->zmodem_receive($this->client,$zap,$this->recv,$this->node->address,$this->force_queue);
return ($rc === self::RCDO || $rc === self::ERROR);
}

View File

@@ -273,10 +273,11 @@ final class Zmodem extends Protocol implements CRCInterface,ZmodemInterface
/**
* Setup our ZMODEM session
*
* @param bool $force_queue Not used here
* @return int
* @throws \Exception
*/
public function protocol_session(): int
public function protocol_session(bool $force_queue=FALSE): int
{
$proto = $this->originate ? $this->node->optionGet(self::P_MASK) : $this->optionGet(self::P_MASK);
@@ -301,7 +302,7 @@ final class Zmodem extends Protocol implements CRCInterface,ZmodemInterface
* @param int $canzap
* @return int
*/
public function zmodem_receive(SocketClient $client,int $canzap,Receive $recv,Address $ao): int
public function zmodem_receive(SocketClient $client,int $canzap,Receive $recv,Address $ao,bool $force_queue=FALSE): int
{
Log::debug(sprintf('%s:+ Starting ZModem Receive [%d]',self::LOGKEY,$canzap));
@@ -1489,7 +1490,7 @@ final class Zmodem extends Protocol implements CRCInterface,ZmodemInterface
$filesleft = -1;
} else {
$this->recv->new($file,$ao);
$this->recv->new($file,$ao,$this->force_queue);
}
return self::ZFILE;