Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 3968ceb651dc357e64c94fbcea74c5490dc052a4
Ticket: 3472316fffffffffffffffffffffffffffffffff
fconfigure <sock> -error called twice in Connect
User & Date: zwischenzugs on 2012-01-11 09:32:04
Changes

  1. assignee changed to: "patthoyts"
  2. cmimetype changed to: "text/plain"
  3. comment changed to:
    It appears that if you call fconfigure twice on a reset socket (for example) a call to fconfigure <sock> -error can only be called once to retrieve the error.
    
    [Terminal 1]
    T1 $ tclsh
    % socket -server sockproc 12345
    sock5
    % 
    
    [Terminal 2]
    T2 $ tclsh
    % socket localhost 12345
    sock5
    % 
    
    [Terminal 1]
    % ^C
    T1 $
    
    [Terminal 2]
    % fconfigure sock5 -error
    connection reset by peer
    % fconfigure sock5 -error
    % 
    
    It seems this causes this if clause to ultimately return an error string which means it's not possible to determine whether the writeable socket has eof and/or threw an error:
    
        if {
        [eof $state(sock)] ||
        [string length [fconfigure $state(sock) -error]]
        } then {
        Finish $token "connect failed [fconfigure $state(sock) -error]" 1
        } else {
    
    tcl8.5.11/library/http/http.tcl
    
    As an aside, the documentation for socket appears not to state that the error message can only be retrieved once.
    
    If the fconfigure <sock> -error is run twice in quick succession this appears to make no difference (ie I couldn't determine that it was a race condition with sockets still in the OS's memory).
    
  4. foundin changed to: "obsolete: 8.5.11"
  5. is_private changed to: "0"
  6. priority changed to: "5 Medium"
  7. resolution changed to: "None"
  8. status changed to: "Open"
  9. submitter changed to: "zwischenzugs"
  10. subsystem changed to: "29. http Package"
  11. title changed to: "fconfigure <sock> -error called twice in Connect"
  12. type changed to: "Bug"