Change BINKP so that we send more packets in the same session, when we have more than msgs_pkt to send
This commit is contained in:
parent
5b7ec1a629
commit
049b2c7204
@ -9,6 +9,7 @@ use Illuminate\Support\Facades\Log;
|
||||
use League\Flysystem\UnreadableFileEncountered;
|
||||
|
||||
use App\Classes\Crypt;
|
||||
use App\Classes\Node;
|
||||
use App\Classes\Protocol as BaseProtocol;
|
||||
use App\Classes\Sock\SocketClient;
|
||||
use App\Classes\Sock\SocketException;
|
||||
@ -754,18 +755,14 @@ final class Binkp extends BaseProtocol
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Add our mail to the queue if we have authenticated
|
||||
if ($this->node->aka_authed)
|
||||
foreach ($this->node->aka_remote_authed as $ao) {
|
||||
if (! $ao->validated) {
|
||||
Log::alert(sprintf('%s:! Address [%s] is not validated, so we wont bundle mail for it',self::LOGKEY,$ao->ftn));
|
||||
continue;
|
||||
}
|
||||
|
||||
$this->send->mail($ao);
|
||||
$this->send->files($ao);
|
||||
}
|
||||
|
||||
/**
|
||||
* http://ftsc.org/docs/fts-1026.001
|
||||
* M_NUL "TRF netmail_bytes arcmail_bytes"
|
||||
* traffic prognosis (in bytes) for the netmail
|
||||
* (netmail_bytes) and arcmail + files (arcmail_bytes),
|
||||
* both are decimal ASCII strings
|
||||
*/
|
||||
// @todo This is affectively redundant, because we are not determining our mail until later
|
||||
$this->msgs(self::BPM_NUL,sprintf('TRF %lu %lu',$this->send->mail_size,$this->send->files_size));
|
||||
|
||||
if ($this->md_challenge) {
|
||||
@ -827,21 +824,8 @@ final class Binkp extends BaseProtocol
|
||||
$this->sessionClear(self::SE_DELAYEOB);
|
||||
|
||||
if (! $this->send->togo_count && $this->sessionGet(self::SE_NOFILES) && $this->capGet(self::F_MULTIBATCH,self::O_YES)) {
|
||||
// Add our mail to the queue if we have authenticated
|
||||
if ($this->node->aka_authed)
|
||||
foreach ($this->node->aka_remote_authed as $ao) {
|
||||
Log::debug(sprintf('%s:- Checking for any new mail and files to [%s]',self::LOGKEY,$ao->ftn));
|
||||
$this->getFiles($this->node);
|
||||
|
||||
if (! $ao->validated) {
|
||||
Log::alert(sprintf('%s:! Address [%s] is not validated, so we wont bundle mail for it',self::LOGKEY,$ao->ftn));
|
||||
continue;
|
||||
}
|
||||
|
||||
$this->send->mail($ao);
|
||||
$this->send->files($ao);
|
||||
}
|
||||
|
||||
Log::debug(sprintf('%s:- We have [%d] items to send to [%s]',self::LOGKEY,$this->send->togo_count,$ao->ftn));
|
||||
if ($this->send->togo_count)
|
||||
$this->sessionClear(self::SE_NOFILES|self::SE_SENTEOB);
|
||||
}
|
||||
@ -1226,7 +1210,6 @@ final class Binkp extends BaseProtocol
|
||||
|
||||
/**
|
||||
* @todo It appears when we poll a node, we dont ask for passwords, but we still send echomail and files.
|
||||
* @todo We should only send netmail if unauthenticated
|
||||
*/
|
||||
private function M_pwd(string $buf): bool
|
||||
{
|
||||
@ -1311,24 +1294,13 @@ final class Binkp extends BaseProtocol
|
||||
if (strlen($opt))
|
||||
$this->msgs(self::BPM_NUL,sprintf('OPT%s',$opt));
|
||||
|
||||
// Add our mail to the queue if we have authenticated
|
||||
// @todo This is effectively redundant, because we are not getting files until later
|
||||
$this->msgs(self::BPM_NUL,sprintf('TRF %lu %lu',$this->send->mail_size,$this->send->files_size));
|
||||
|
||||
if ($this->node->aka_authed) {
|
||||
foreach ($this->node->aka_remote_authed as $ao) {
|
||||
if (! $ao->validated) {
|
||||
Log::alert(sprintf('%s:! Address [%s] is not validated, so we wont bundle mail for it',self::LOGKEY,$ao->ftn));
|
||||
continue;
|
||||
}
|
||||
|
||||
$this->send->mail($ao);
|
||||
$this->send->files($ao);
|
||||
}
|
||||
|
||||
$this->msgs(self::BPM_NUL,sprintf('TRF %lu %lu',$this->send->mail_size,$this->send->files_size));
|
||||
$this->msgs(self::BPM_OK,sprintf('%ssecure',$have_pwd ? '' : 'non-'));
|
||||
|
||||
} else {
|
||||
// @todo Send any direct netmail to this node, if that node is unknown to us
|
||||
$this->msgs(self::BPM_NUL,sprintf('TRF %lu %lu',$this->send->mail_size,$this->send->files_size));
|
||||
$this->msgs(self::OK,'non-secure');
|
||||
}
|
||||
|
||||
@ -1363,6 +1335,8 @@ final class Binkp extends BaseProtocol
|
||||
&& (! $this->sessionGet(self::SE_NOFILES))
|
||||
&& (! $this->send->fd))
|
||||
{
|
||||
$this->getFiles($this->node);
|
||||
|
||||
// Open our next file to send
|
||||
if ($this->send->togo_count && ! $this->send->fd) {
|
||||
Log::info(sprintf('%s:- Opening next file to send',self::LOGKEY));
|
||||
@ -1499,6 +1473,42 @@ final class Binkp extends BaseProtocol
|
||||
return $this->rc;
|
||||
}
|
||||
|
||||
public function getFiles(Node $node): void
|
||||
{
|
||||
// Add our mail to the queue if we have authenticated
|
||||
if ($node->aka_authed) {
|
||||
Log::debug(sprintf('%s:- We have authed these AKAs [%s]',self::LOGKEY,$node->aka_remote_authed->pluck('ftn')->join(',')));
|
||||
|
||||
foreach ($node->aka_remote_authed as $ao) {
|
||||
Log::debug(sprintf('%s:- Checking for any new mail and files to [%s]',self::LOGKEY,$ao->ftn));
|
||||
|
||||
if (! $ao->validated) {
|
||||
Log::alert(sprintf('%s:! Address [%s] is not validated, so we wont bundle mail for it',self::LOGKEY,$ao->ftn));
|
||||
continue;
|
||||
}
|
||||
|
||||
$this->send->mail($ao);
|
||||
$this->send->files($ao);
|
||||
|
||||
/*
|
||||
* Add "dynamic files", eg: nodelist, nodelist segment, status reports.
|
||||
* Dynamic files are built on the fly
|
||||
* * query "dynamic" for items for the address
|
||||
* * column 'method' identifies the method that will be called, with the $ao as the argument
|
||||
* * a 'new Item' is added to the queue
|
||||
* * when it its ready to be sent, the __tostring() is called that renders it
|
||||
* * when sent, the dynamic table is updated with the sent_at
|
||||
*/
|
||||
}
|
||||
|
||||
Log::debug(sprintf('%s:- We have [%d] items to send to [%s]',self::LOGKEY,$this->send->togo_count,$ao->system->name));
|
||||
|
||||
} else {
|
||||
// @todo We should only send netmail if unauthenticated - netmail that is direct to this node (no routing)
|
||||
Log::debug(sprintf('%s:- Not AUTHed so not looking for mail, but we know these akas [%s]',self::LOGKEY,$node->aka_remote->pluck('ftn')->join(',')));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Strip blanks at the beginning of a string
|
||||
*
|
||||
|
Loading…
Reference in New Issue
Block a user