mirror of
https://github.com/tailscale/tailscale.git
synced 2024-11-29 13:05:46 +00:00
wgengine/wgcfg: prevent ReconfigDevice from hanging on error
When wireguard-go's UAPI interface fails with an error, ReconfigDevice hangs. Fix that by buffering the channel and closing the writer after the call. The code now matches the corresponding code in DeviceConfig, where I got it right. Signed-off-by: Josh Bleecher Snyder <josh@tailscale.com>
This commit is contained in:
parent
462f7e38fc
commit
1f6c4ba7c3
@ -47,9 +47,10 @@ func ReconfigDevice(d *device.Device, cfg *Config, logf logger.Logf) (err error)
|
|||||||
}
|
}
|
||||||
|
|
||||||
r, w := io.Pipe()
|
r, w := io.Pipe()
|
||||||
errc := make(chan error)
|
errc := make(chan error, 1)
|
||||||
go func() {
|
go func() {
|
||||||
errc <- d.IpcSetOperation(r)
|
errc <- d.IpcSetOperation(r)
|
||||||
|
w.Close()
|
||||||
}()
|
}()
|
||||||
|
|
||||||
err = cfg.ToUAPI(w, prev)
|
err = cfg.ToUAPI(w, prev)
|
||||||
|
Loading…
Reference in New Issue
Block a user