# counting the number of connections?

3 messages from 2009-02-28 to 2009-03-05. Participants: Tay Ray Chuan, David Kågedal, Johannes Schindelin.
Thread: https://gitlist.dev/t/18059

## Tay Ray Chuan, 2009-02-28 06:44

Subject: counting the number of connections?
Message-ID: <be6fef0d0902272244q468b1fa4sacdc15afa9a65f15@mail.gmail.com>
URL: https://gitlist.dev/e/be6fef0d0902272244q468b1fa4sacdc15afa9a65f15%40mail.gmail.com

```
Hi,

some time ago I noticed curl doesn't remember your credentials (apart
from those it can get from ~/.netrc), and very recently there was an
thread on repeated prompting for credentials while pushing to https.

I've written a simple patch series, which allows git to play nice
without curl_multi. That is, git uses a single persistent connection
throughout.

However, I'm at a loss at how to test for this. How does one count the
number of connections made during the lifespan of a program's
execution? So far, I've been relying on my firewall log (Comodo on
windows). Perhaps there a more operating system/software-agnostic
method to do this?

-- 
Cheers,
Ray Chuan

```

## David Kågedal, 2009-03-05 16:18

Subject: Re: counting the number of connections?
Message-ID: <87ab80j649.fsf@krank.kagedal.org>
URL: https://gitlist.dev/e/87ab80j649.fsf%40krank.kagedal.org
In-Reply-To: <be6fef0d0902272244q468b1fa4sacdc15afa9a65f15@mail.gmail.com>

```
Tay Ray Chuan <rctay89@gmail.com> writes:

> Hi,
>
> some time ago I noticed curl doesn't remember your credentials (apart
> from those it can get from ~/.netrc), and very recently there was an
> thread on repeated prompting for credentials while pushing to https.
>
> I've written a simple patch series, which allows git to play nice
> without curl_multi. That is, git uses a single persistent connection
> throughout.
>
> However, I'm at a loss at how to test for this. How does one count the
> number of connections made during the lifespan of a program's
> execution? So far, I've been relying on my firewall log (Comodo on
> windows). Perhaps there a more operating system/software-agnostic
> method to do this?

You could set up a single-use tcp forwarder which will make any second
connection fail. Using socat, for instance:

  $ socat tcp-listen:2222,bind=localhost tcp:my.server:22 &
  $ nc localhost 2222
  SSH-2.0-OpenSSH_5.1p1 Debian-3ubuntu1
  ^C
  $ nc localhost 2222
  localhost [127.0.0.1] 2222 (?) : Connection refused

-- 
David Kågedal

```

## Johannes Schindelin, 2009-03-05 17:00

Subject: Re: counting the number of connections?
Message-ID: <alpine.DEB.1.00.0903051758440.6524@intel-tinevez-2-302>
URL: https://gitlist.dev/e/alpine.DEB.1.00.0903051758440.6524%40intel-tinevez-2-302
In-Reply-To: <87ab80j649.fsf@krank.kagedal.org>

```
Hi,

On Thu, 5 Mar 2009, David Kågedal wrote:

> Tay Ray Chuan <rctay89@gmail.com> writes:
> 
> > some time ago I noticed curl doesn't remember your credentials (apart 
> > from those it can get from ~/.netrc), and very recently there was an 
> > thread on repeated prompting for credentials while pushing to https.
> >
> > I've written a simple patch series, which allows git to play nice
> > without curl_multi. That is, git uses a single persistent connection
> > throughout.
> >
> > However, I'm at a loss at how to test for this. How does one count the
> > number of connections made during the lifespan of a program's
> > execution? So far, I've been relying on my firewall log (Comodo on
> > windows). Perhaps there a more operating system/software-agnostic
> > method to do this?
> 
> You could set up a single-use tcp forwarder which will make any second
> connection fail. Using socat, for instance:
> 
>   $ socat tcp-listen:2222,bind=localhost tcp:my.server:22 &
>   $ nc localhost 2222
>   SSH-2.0-OpenSSH_5.1p1 Debian-3ubuntu1
>   ^C
>   $ nc localhost 2222
>   localhost [127.0.0.1] 2222 (?) : Connection refused

AFAICT Ray wants to provide tests for Git's test suite, and introducing 
socat as a dependency for our tests does not really fly all that well.

But IIRC somebody convinced Ray that it is better to require a new-enough 
cURL version so that the patch becomes moot itself.

Ciao,
Dscho

```
