Timeouting the pkg_add

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Timeouting the pkg_add

sven falempin
Dear Tech Readers,

In ftp command -w is available, very useful for crappy networks.
pkg_add does not have any of this.

The HTTP layer is not configuring Timeout.
( in /usr/libdata/perl5/OpenBSD/./PackageRepository/HTTP.pm )
        my $o = IO::Socket::INET->new(
                PeerHost => $host,
                PeerPort => $port);
( plenty of option here like MultiHomed or Timeout, ReuseAddr, blocking )

Nor using an nonblocking Read later

sub get_header
{
        my $o = shift;
        my $l = $o->getline;
        if ($l !~ m,^HTTP/1\.1\s+(\d\d\d),) {

Most usage may be used in FTP so none notice so far.

SCP and FTP are done with the actual binary, ftp handle http well and
is ready to get an option for crappy network.

Maybe a patch can add a '-w' to pkg_add and push it there :

sub ftp_cmd
{
        my $self = shift;
        return $self->SUPER::ftp_cmd." -S session=/dev/fd/".fileno($self->{fh});
}

And use this for all transfer ?

Or is the user supposed to manage this out of the pkg_add tool.

I can propose a patch if not *

Best.

--
--
---------------------------------------------------------------------------------------------------------------------
Knowing is not enough; we must apply. Willing is not enough; we must do

Reply | Threaded
Open this post in threaded view
|

Re: Timeouting the pkg_add

Stuart Henderson
On 2018/06/14 13:40, sven falempin wrote:

> Dear Tech Readers,
>
> In ftp command -w is available, very useful for crappy networks.
> pkg_add does not have any of this.
>
> The HTTP layer is not configuring Timeout.
> ( in /usr/libdata/perl5/OpenBSD/./PackageRepository/HTTP.pm )
>         my $o = IO::Socket::INET->new(
>                 PeerHost => $host,
>                 PeerPort => $port);
> ( plenty of option here like MultiHomed or Timeout, ReuseAddr, blocking )
>
> Nor using an nonblocking Read later
>
> sub get_header
> {
>         my $o = shift;
>         my $l = $o->getline;
>         if ($l !~ m,^HTTP/1\.1\s+(\d\d\d),) {
>
> Most usage may be used in FTP so none notice so far.
>
> SCP and FTP are done with the actual binary, ftp handle http well and
> is ready to get an option for crappy network.
>
> Maybe a patch can add a '-w' to pkg_add and push it there :
>
> sub ftp_cmd
> {
>         my $self = shift;
>         return $self->SUPER::ftp_cmd." -S session=/dev/fd/".fileno($self->{fh});
> }
>
> And use this for all transfer ?
>
> Or is the user supposed to manage this out of the pkg_add tool.
>
> I can propose a patch if not *
>
> Best.
>
> --
> --
> ---------------------------------------------------------------------------------------------------------------------
> Knowing is not enough; we must apply. Willing is not enough; we must do
>

I don't think it makes a lot of sense, if you know you're on a crappy network
that drops connection requests and would prefer to see failures quickly rather
than give it a better chance of actually connecting, you can just set
sysctl net.inet.tcp.keepinittime (the value is in half-seconds).

Reply | Threaded
Open this post in threaded view
|

Re: Timeouting the pkg_add

Marc Espie-2
In reply to this post by sven falempin
On Thu, Jun 14, 2018 at 01:40:28PM -0400, sven falempin wrote:

> Dear Tech Readers,
>
> In ftp command -w is available, very useful for crappy networks.
> pkg_add does not have any of this.
>
> The HTTP layer is not configuring Timeout.
> ( in /usr/libdata/perl5/OpenBSD/./PackageRepository/HTTP.pm )
>         my $o = IO::Socket::INET->new(
>                 PeerHost => $host,
>                 PeerPort => $port);
> ( plenty of option here like MultiHomed or Timeout, ReuseAddr, blocking )

That stuff is unused, disregard completly.

> Maybe a patch can add a '-w' to pkg_add and push it there :

Nope, use FETCH_CMD if necessary, and push whatever -w you need there.

Note that this is documente

Reply | Threaded
Open this post in threaded view
|

Re: Timeouting the pkg_add

sven falempin
Thank you all, looks like it was just noise, the unused http code got me worry.

--

Short: DOH !!
Code :
/usr/libdata/perl5/OpenBSD/Paths.pm:sub ftp() { $ENV{'FETCH_CMD'} ||
'/usr/bin/ftp' }
Man :
FETCH_CMD    Override use of ftp(1).  Must point to a command that
                           understands ${FETCH_CMD} -o - url.


On Thu, Jun 14, 2018 at 5:52 PM Marc Espie <[hidden email]> wrote:

>
> On Thu, Jun 14, 2018 at 01:40:28PM -0400, sven falempin wrote:
> > Dear Tech Readers,
> >
> > In ftp command -w is available, very useful for crappy networks.
> > pkg_add does not have any of this.
> >
> > The HTTP layer is not configuring Timeout.
> > ( in /usr/libdata/perl5/OpenBSD/./PackageRepository/HTTP.pm )
> >         my $o = IO::Socket::INET->new(
> >                 PeerHost => $host,
> >                 PeerPort => $port);
> > ( plenty of option here like MultiHomed or Timeout, ReuseAddr, blocking )
>
> That stuff is unused, disregard completly.
>
> > Maybe a patch can add a '-w' to pkg_add and push it there :
>
> Nope, use FETCH_CMD if necessary, and push whatever -w you need there.
>
> Note that this is documente



--
--
---------------------------------------------------------------------------------------------------------------------
Knowing is not enough; we must apply. Willing is not enough; we must do