eclipse / paho.golang

Go libraries
Other
327 stars 92 forks source link

fix: respect context cancellation while using the provided Dialer #248

Closed Lorderot closed 4 months ago

Lorderot commented 4 months ago

A ConnectTimeout setting must be respected while connecting through the proxy:

  1. Call DialContext if the custom dialer implements it.
  2. Perform the blocking Dial call in a new goroutine, and respect context cancellation (potentially "leaked" goroutine)
Lorderot commented 4 months ago

Hi @alsm @MattBrittan, could you, please, check this small PR?

MattBrittan commented 4 months ago

Thanks for the PR; looks good to me (as proxy.Dial calls FromEnvironment() I would not expect this to break any existing use-cases).

Note: Please don't chase these (especially after one day). We will look at PR's but it may sometimes take a while (having accepted, very small, PR's that broke things I want to have a decent look before accepting).