:: Re: [Libbitcoin] network connection…
Etusivu
Poista viesti
Vastaa
Lähettäjä: Noel Maersk
Päiväys:  
Vastaanottaja: libbitcoin
Aihe: Re: [Libbitcoin] network connection algorithm
On Wed, Dec 11, 2013 at 03:44:30PM +0000, Amir Taaki wrote:
> The network flow is something like:
>
> at the start call try_outbound_connects() which does a for loop calling
> try_connect_once() N times.
>
> 1. try_connect_once()
> hosts.fetch_address()
> 2. attempt_connect()
> FAIL: try_connect_once()
> connect()
> 3. handle_connect()
> FAIL: try_connect_once()
> setup_new_channel() / subscribe_stop()
> 4. channel_stopped()
> try_connect_once()
>
> so I'm not sure where it is creating +1 connections. there should be N
> slots that are always reconnecting and that's it. but for some reason it
> manages to get past 8 to 9 connection attempts.


Here's a (sloppy) GDB backtrace right before the ASSERT fails:

http://veox.pw/dump/obworker-2013-12-11.gdb.txt

Note that I've moved the assertion code to the end of
protocol::handle_connect(...), so that it triggers after
connections_ is pushed to, not on the next pass. I can produce a
backtrace with vanilla code, too, if needed, or with an unoptimized
build of libbitcoin/obelisk.

I've tried changing both ASSERTs in protocol.cpp like this:

-    BITCOIN_ASSERT(connections_.size() <= max_outbound_);
+    BITCOIN_ASSERT(connections_.size() <= max_outbound_+1);


It still triggers, so this not an OBOE.

I'll try with more log_debug()'s.