BINKP responding to incoming netmail pings

This commit is contained in:
Deon George
2021-07-18 22:10:21 +10:00
parent 7bb3e12f66
commit 9dcfe6b17d
19 changed files with 145 additions and 54 deletions

View File

@@ -102,7 +102,7 @@ final class Binkp extends BaseProtocol
if (! parent::onConnect($client)) {
$this->session(self::SESSION_BINKP,$client,(new Address));
$this->client->close();
Log::info(sprintf('%s: = End - Connection closed [%s]',__METHOD__,$client->getAddress()));
Log::info(sprintf('%s: = End - Connection closed [%s]',__METHOD__,$client->address_remote));
}
return NULL;
@@ -133,9 +133,9 @@ final class Binkp extends BaseProtocol
$this->msgs(self::BPM_NUL,
sprintf('OPT%s%s%s%s%s%s',
($this->setup->opt_nda) ? ' NDA' : '',
($this->setup->opt_nr&self::O_WANT) ? ' NR' : '',
($this->setup->opt_nd&self::O_THEY) ? ' ND' : '',
($this->setup->opt_mb&self::O_WANT) ? ' MB' : '',
($this->setup->opt_nr&self::O_WANT) ? ' NR' : '',
($this->setup->opt_nd&self::O_THEY) ? ' ND' : '',
($this->setup->opt_mb&self::O_WANT) ? ' MB' : '',
($this->setup->opt_cr&self::O_WE) ? ' CRYPT' : '',
($this->setup->opt_cht&self::O_WANT) ? ' CHAT' : ''));
}
@@ -622,8 +622,11 @@ final class Binkp extends BaseProtocol
// @todo lock nodes
$this->node->ftn = $o;
// @todo Find files for node
$this->send->add('/tmp/aa');
// Add our mail to the queue if we have authenticated
if ($this->node->aka_authed)
foreach ($this->node->aka_remote as $ao) {
$this->send->mail($ao);
}
Log::info(sprintf('%s: = Node has [%lu] mail and [%lu] files - [%lu] items',__METHOD__,$this->send->mail_size,$this->send->file_size,$this->send->total_count));
@@ -706,7 +709,13 @@ final class Binkp extends BaseProtocol
$this->sessionClear(self::SE_DELAYEOB);
if (! $this->send->total_count && $this->sessionGet(self::SE_NOFILES)) {
// @todo See if we need to send anything else, based on what we just recevied
// Add our mail to the queue if we have authenticated
if ($this->node->aka_authed)
foreach ($this->node->aka_remote as $ao) {
Log::debug(sprintf('%s: - Checking for any new mail to [%s]',__METHOD__,$ao->ftn));
$this->send->mail($ao);
}
if ($this->send->total_count)
$this->sessionClear(self::SE_NOFILES);
}
@@ -760,7 +769,7 @@ final class Binkp extends BaseProtocol
&& $this->recv->size == Arr::get($file,'file.size')
&& $this->recv->filepos == $file['offs'])
{
$this->recv->open($file['offs']<0);
$this->recv->open($this->node->address,$file['offs']<0);
return 1;
}
@@ -768,7 +777,7 @@ final class Binkp extends BaseProtocol
$this->recv->new($file['file']);
try {
switch ($this->recv->open($file['offs']<0)) {
switch ($this->recv->open($this->node->address,$file['offs']<0)) {
case self::FOP_ERROR:
Log::error(sprintf('%s: ! File Error',__METHOD__));