Skip to content
  • David Fifield's avatar
    Wait briefly after calling ListenAndServe{TLS} to see if it errors. · ea7b9c02
    David Fifield authored
    This is a port of commit e3f3054f8b74caa639a6d9be09702693af9a70e7 from
    meek.
    
    In the previous commit, we changed from separate Listen and Serve steps
    to always calling ListenAndServe. However, we would really like to
    immediately get feedback if any errors happen in the Listen step inside
    the call, because it's much better for debugging if those errors get
    reported to tor through SMETHOD-ERROR--rather than reporting success to
    tor and actually logging an error only in the snowflake log. So we wait
    100 ms for an error to occur before deciding that the Listen succeeded.
    
    We don't need to apply this hack to the ACME HTTP-01 listener, because
    it's a plaintext listener. Unlike in the TLS case, there isn't any
    internal magic that the net library does that we have to rely on. We
    just call net.ListenTCP and check for an error.
    ea7b9c02