raindrops RubyGem user+dev discussion/patches/pulls/bugs/help
 help / color / mirror / code / Atom feed
From: Hleb Valoshka <375gnu@gmail.com>
To: raindrops@librelist.org
Subject: Re: [PATCH 2/2] Return real stats instead of True
Date: Mon, 9 Sep 2013 23:35:16 +0300	[thread overview]
Message-ID: <CAAB-Kc=SBffL+2ymdUxhcz26RKnSLUqQOB0e=zLN+8JX_GRUww@mail.gmail.com> (raw)
In-Reply-To: 20130909194449.GA16692@dcvr.yhbt.net

On 9/9/13, Eric Wong <normalperson@yhbt.net> wrote:

>> But the real reason may be something else: I've got IPv6 address using
>> Teredo and getnameinfo returns error with it. So it cause other
>> errors, I need to check it better.
> OK.

Using some debug output I've found the reason (it's not a teredo, it
was disabled).

Lets look into linux_inet_diag.c, if tcp_listener_stats has only 1 arg, you do

rb_hash_aset(rv, addrs, tcp_stats(&args, addrs));
(or cur = rb_ary_entry(addrs, 0);
rb_hash_aset(rv, cur, tcp_stats(&args, cur)); )
return rv;

But if it has more agrs, you do

    for (i = 0; i < len; i++) {
      union any_addr check;
      VALUE cur = rb_ary_entry(addrs, i);

      parse_addr(&check, cur);
      rb_hash_aset(rv, cur, Qtrue);

and then fallback to branch where arg is nil, the most interesting
thing is calling of st_AND_hash(key, stats, hash) which has

 if (rb_hash_lookup(hash, key) == Qtrue) {
      VALUE v = rb_listen_stats(stats);
      rb_hash_aset(hash, key, v);

The problem is `key'. It may differ from what you expect.

For example, in tests you do
TEST_ADDR = ENV["TEST_HOST6"] || "::1"
addr1, addr2 = "[#{TEST_ADDR}]:#{port1}", "[#{TEST_ADDR}]:#{port2}"

In my last case they are [::1]:42244, [::1]:46335, but values of `key'
for them are:
[::1%3336]:42244, [::1%3336]:46335, so rb_hash_lookup never returns Qtrue.

  reply	other threads:[~2013-09-09 20:35 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-09 19:03 [PATCH 1/2] Add setup and teardown for ipv6 tests Hleb Valoshka
2013-09-09 19:03 ` [PATCH 2/2] Return real stats instead of True Hleb Valoshka
2013-09-09 19:20   ` Eric Wong
2013-09-09 19:37     ` Hleb Valoshka
2013-09-09 19:44       ` Eric Wong
2013-09-09 20:35         ` Hleb Valoshka [this message]
2013-09-09 22:03           ` Eric Wong
2013-09-10  7:18             ` Hleb Valoshka
2016-02-25  9:54     ` Eric Wong
2014-11-14  3:15 ` [PATCH 1/2] Add setup and teardown for ipv6 tests Eric Wong

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:

  List information: https://yhbt.net/raindrops/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAAB-Kc=SBffL+2ymdUxhcz26RKnSLUqQOB0e=zLN+8JX_GRUww@mail.gmail.com' \
    --to=375gnu@gmail.com \
    --cc=raindrops@librelist.org \


* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).