Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: bd2990cfdcb13027f221adab32ca01fa170a5382
Ticket: 2446662fffffffffffffffffffffffffffffffff
chanIO.test failures on Win32 msys/mingw
User & Date: davygrvy on 2009-01-08 15:55:36
Changes

  1. icomment:
    > (2) Perusing the [fconfigure -blocking] bit to decide the behavior just
    > like for pipes (which does make sense ex nihilo) would pose a compatibility
    > issue with sockets (imagine apps talking to rude servers that don't react
    > to a FIN ... they would block forever in [close])
    
    Not exactly..  Reviewing the close chart @ http://msdn.microsoft.com/en-us/library/ms738547(VS.85).aspx and http://msdn.microsoft.com/en-us/library/ms737582(VS.85).aspx I see the following behavior as possible:
    
        client     |     server
    
    (1)close $s w
                       (2)if {[eof $s]} { finishSending $s; fconfigure -blocking 1; close $s }
    (3)if {[eof $s]} {fconfigure -blocking 1; close $s}
    
    As the client was the initiator, TIME_WAIT doesn't have to collect on the client as the EOF indicator describes the closure as complete.  Just let shutdown return immediately and collect the ACK later with setsockopt(SO_DONTLINGER) prior to closesocket().  Which happens to be the default anyways.
    
    Now if you would prefer an abortive close:
    
        client     |     server
    
    (1)fconfigure -blocking 0; close $s
                     (2) don't care
    
    Same as above, but setsockopt(SO_LINGER) would be set with l_onoff=1,l_linger=0 prior to closesocket() for an immediate abortive close.  closesocket() _will_ _not_ _block_ with that setting.
    
    This unfortunately appears to be in reverse order and might render old code possibly broken.  But given the new ability to do a half-close to initiate a graceful and that resets are already silent EOFs, all might be well.
    
    
    
  2. login: "davygrvy"
  3. mimetype: "text/plain"
  4. username: "davygrvy"