From owner-freebsd-net@FreeBSD.ORG Mon Jul 16 01:53:10 2012 Return-Path: Delivered-To: freebsd-net@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 350DC106566C for ; Mon, 16 Jul 2012 01:53:10 +0000 (UTC) (envelope-from sepherosa@gmail.com) Received: from mail-ob0-f182.google.com (mail-ob0-f182.google.com [209.85.214.182]) by mx1.freebsd.org (Postfix) with ESMTP id EEC6D8FC0C for ; Mon, 16 Jul 2012 01:53:09 +0000 (UTC) Received: by obbun3 with SMTP id un3so10882610obb.13 for ; Sun, 15 Jul 2012 18:53:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=oElCVt/MWG/OAbCDe9dMfYymQ7xA9R0FdwsqxtySAVU=; b=ov5yGKaqBsVaUkqPJKtybcqb6/XzUfpO/RJp0MPEfeiMaNDhm28uwRs3lRbjthTU2m JhIOEf4MKeJsk43uPpCkuJ8e6nS6KwSTNtf34bt+WpHHn6jzkBbl6RmJmLiIcRYu1DdT St8BZgom9OttOYRQcyrEGab5o2F8ZRvoxmwr/BP0thVAs2EhPddX5WhhtwX7DCOoX2Aq G3CNjW470tXZywH/aWko5Ira4CcKjToYQiDN4mxrEMLlEd03ZPwoBuXQLKlz+jmLJg4e lgjoaUj/yI/kxOZ1GybxFth5A+ZxTteBiW3uj17k6GY8CPRiFP/CrmOTlTHi3OENevL6 qLAw== MIME-Version: 1.0 Received: by 10.60.168.230 with SMTP id zz6mr2183077oeb.11.1342403589591; Sun, 15 Jul 2012 18:53:09 -0700 (PDT) Received: by 10.182.35.135 with HTTP; Sun, 15 Jul 2012 18:53:09 -0700 (PDT) In-Reply-To: <5002E616.8050202@myri.com> References: <4FFF9E48.6000403@myri.com> <500060DB.3090407@myri.com> <5002E616.8050202@myri.com> Date: Mon, 16 Jul 2012 09:53:09 +0800 Message-ID: From: Sepherosa Ziehau To: Reese Faucette Content-Type: text/plain; charset=ISO-8859-1 Cc: freebsd-net@freebsd.org Subject: Re: question in tcp_do_segment() X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 16 Jul 2012 01:53:10 -0000 On Sun, Jul 15, 2012 at 11:47 PM, Reese Faucette wrote: > On 7/15/2012 3:26 AM, Sepherosa Ziehau wrote: > >> !tcp_timer_active() means that the connection's retransmit timer is >> not _set_ yet (please note, it is _not_ "has fired"). As far as I >> understand this code, it in turn means that this connection doesn't >> have any segments that were sent but not yet ACKed. > > > You'd think that was the case from the name, but tcp_timer_active() calls > callout_active() which checks for fired. If you want to check for "timer Hmm, callout_active() is not used to check for whether the callout is fired or not; it is used to check whether callout_reset() has been called but callout_stop() is not yet been called. IMO, callout_reset() is "set" the callout, callout_stop() is "unset" the callout. AFAIR, callout_pending() is kinda check for whether the callback function of the callout "is being executed" or not (PENDING bit is probably cleared immediately before running the callback function). Best Regards, sephe > set" you need to use callout_pending(). > -reese > > -- Tomorrow Will Never Die