Skip to content
  • ccollins476ad's avatar
    linux - Don't log "can't accept" error on close. (#8) · 8725f322
    ccollins476ad authored
    This is a hack which silences an extraneous log message.  The message
    gets reported due to an apparent race condition involving the
    `sktLoop()` function in `linux/hci/hci.go`.  This function implements a
    socket-read loop that only returns on error.  It is called as a
    Goroutine, and typically continues to run until the process terminates.
    
    If client code closes the owning `Device` at an inopportune time
    (presumably during the socket read), the `Read()` call returns an
    `io.EOF` error, which causes `NewDevice()` to log the following message:
    
        can't accept: skt: EOF
    
    Since the API permits the user to close the device at any time, this
    error message is extraneous.
    
    This commit simply inhibits the logging of the error message in case of
    EOF.  This is not a long-term solution, but it does fix the visible
    issue.
    8725f322