Re: [hybi] Clarify the role of closing handshake

Takeshi Yoshino <tyoshino@google.com> Mon, 14 February 2011 23:25 UTC

Return-Path: <tyoshino@google.com>
X-Original-To: hybi@core3.amsl.com
Delivered-To: hybi@core3.amsl.com
Received: from localhost (localhost [127.0.0.1]) by core3.amsl.com (Postfix) with ESMTP id 8923A3A6DA9 for <hybi@core3.amsl.com>; Mon, 14 Feb 2011 15:25:50 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -105.734
X-Spam-Level:
X-Spam-Status: No, score=-105.734 tagged_above=-999 required=5 tests=[AWL=0.242, BAYES_00=-2.599, FM_FORGED_GMAIL=0.622, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_MED=-4, USER_IN_WHITELIST=-100]
Received: from mail.ietf.org ([64.170.98.32]) by localhost (core3.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id SIHsrm7QRCsb for <hybi@core3.amsl.com>; Mon, 14 Feb 2011 15:25:49 -0800 (PST)
Received: from smtp-out.google.com (smtp-out.google.com [216.239.44.51]) by core3.amsl.com (Postfix) with ESMTP id 4B4653A6DD7 for <hybi@ietf.org>; Mon, 14 Feb 2011 15:25:49 -0800 (PST)
Received: from hpaq6.eem.corp.google.com (hpaq6.eem.corp.google.com [172.25.149.6]) by smtp-out.google.com with ESMTP id p1ENQCad016918 for <hybi@ietf.org>; Mon, 14 Feb 2011 15:26:12 -0800
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=google.com; s=beta; t=1297725972; bh=ltSegTiyvJUVSms9auFI+wUI3L0=; h=MIME-Version:In-Reply-To:References:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=h7Rt1f4zqO39Hxp/1680MbJvAn2xbybn/udS7TjocYwshPEcbuC5Ds5bWsQwv3iFk 2D7PYrdCBua8LTpfLCmxQ==
Received: from iyb26 (iyb26.prod.google.com [10.241.49.90]) by hpaq6.eem.corp.google.com with ESMTP id p1ENQ73Y027587 (version=TLSv1/SSLv3 cipher=RC4-SHA bits=128 verify=NOT) for <hybi@ietf.org>; Mon, 14 Feb 2011 15:26:10 -0800
Received: by iyb26 with SMTP id 26so5491103iyb.41 for <hybi@ietf.org>; Mon, 14 Feb 2011 15:26:10 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=beta; h=domainkey-signature:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc:content-type; bh=3xsQtouuuWf63Rv36Hh+mpusrTvoNkDpiFtxL5GezpA=; b=V5Ut5mFR5IylLM76AFEgOixfGwUdzEupEpO1KPdhd8CbWhj5jWyDxSzZBaDhh35e35 iNFM9a6uRy6Ye46tXeow==
DomainKey-Signature: a=rsa-sha1; c=nofws; d=google.com; s=beta; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type; b=OQi7Uwi2pNaqJeVcVN21xYQhieRupx3QuZgjBJTy6AmLbq1OTOgJbRRR3Rga7T76Vh KVNe3l3h8yBCvcymIKzQ==
Received: by 10.231.39.73 with SMTP id f9mr3507377ibe.79.1297725970425; Mon, 14 Feb 2011 15:26:10 -0800 (PST)
MIME-Version: 1.0
Received: by 10.231.17.201 with HTTP; Mon, 14 Feb 2011 15:25:49 -0800 (PST)
In-Reply-To: <CA566BAEAD6B3F4E8B5C5C4F61710C1126E142C9@TK5EX14MBXW605.wingroup.windeploy.ntdev.microsoft.com>
References: <OFAAD26076.80417033-ON88257834.006C2055-88257834.0072D42E@playstation.sony.com> <OF4A78F456.78EA8086-ON88257834.00735B16-88257834.0074BBCC@playstation.sony.com> <AANLkTimizRk+73rHJcw16JdWwM8Ax9dhpUqNxEdPLyL4@mail.gmail.com> <AANLkTikFBdEGwcoya6o7BNAz9cKtetoz6Ahy-0MN4RQu@mail.gmail.com> <AANLkTin-RAVzrENx7973mg+pC2PDjSd26tfC2sLGCoa7@mail.gmail.com> <CA566BAEAD6B3F4E8B5C5C4F61710C1126E142C9@TK5EX14MBXW605.wingroup.windeploy.ntdev.microsoft.com>
From: Takeshi Yoshino <tyoshino@google.com>
Date: Mon, 14 Feb 2011 15:25:49 -0800
Message-ID: <AANLkTinD5M5MbqeMKar-DgpKaU3EAWHZVD9Y0zPfG1ok@mail.gmail.com>
To: Gabriel Montenegro <Gabriel.Montenegro@microsoft.com>
Content-Type: multipart/alternative; boundary="0003255752fe7baaa2049c465f2a"
X-System-Of-Record: true
Cc: "hybi@ietf.org" <hybi@ietf.org>
Subject: Re: [hybi] Clarify the role of closing handshake
X-BeenThere: hybi@ietf.org
X-Mailman-Version: 2.1.9
Precedence: list
List-Id: Server-Initiated HTTP <hybi.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/listinfo/hybi>, <mailto:hybi-request@ietf.org?subject=unsubscribe>
List-Archive: <http://www.ietf.org/mail-archive/web/hybi>
List-Post: <mailto:hybi@ietf.org>
List-Help: <mailto:hybi-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/hybi>, <mailto:hybi-request@ietf.org?subject=subscribe>
X-List-Received-Date: Mon, 14 Feb 2011 23:25:50 -0000

On Mon, Feb 14, 2011 at 12:34, Gabriel Montenegro <
Gabriel.Montenegro@microsoft.com> wrote:

> In A-2 and B, it seems you reversed the Pros and Cons.
>

Oops. Yes, it's reversed...


> I’m not clear on the algorithm for B. Could you formulate in terms of peers
> A and B and clarify which side is doing what?
>

Here's pseudo code for [B].

private closeWriteChannel() {
  socket.send(CLOSE_FRAME);
  writeChannelClosed = true;
}

public initiateClose() {
  closeWriteChannel();
}

public onReceivedCloseFrame() {
  if (!writeChannelClosed) {
    closeWriteChannel();
  }
  socket.close();
}

Here's what happens on each peer.

Normal case:

1. Peer A initiates close by sending a Close frame to peer B
2. Peer B receives a Close frame
3. Peer B sends a Close frame to peer A
4. Peer B closes the underlying transport channel
5. Peer A receives a Close frame
6. Peer A closes the underlying transport channel

In case both side initiate close at approximately same time:

1.
Peer A initiates close by sending a Close frame to peer B
Peer B initiates close by sending a Close frame to peer A
2.
Peer A receives a Close frame
Peer B receives a Close frame
3.
Peer A closes the underlying transport channel
Peer B closes the underlying transport channel


> At any rate, the cons of adding a wait state and additional complexity in
> the protocol is why I prefer the simplicity of A.
>
>
>
> Most of the time, there won’t be a gracious Close, as users will kill the
> browser window, exit out of the tab, etc. So I fear we’re complicating the
> protocol for dubious benefits. We have to deal with sudden termination
> anyway.  At any rate, even if the RST prevents the other peer from receiving
> the WS_Close, the intermediaries will see it.
>

Yes, as far as intermediaries are built to deal with such RST.


>
>
> This is a case of added complexity for very little benefit.
>

I'm not so eager to adopt B. Hmm, ok, how about putting only A-1 as required
spec, and some note for implementor explaining the RST issue and A-2
(Yutaka's idea) as optional solution?

Takeshi