File tree 3 files changed +22
-13
lines changed
3 files changed +22
-13
lines changed Original file line number Diff line number Diff line change @@ -49,7 +49,7 @@ replace github.com/tcnksm/go-httpstat => github.com/kylecarbs/go-httpstat v0.0.0
49
49
50
50
// There are a few minor changes we make to Tailscale that we're slowly upstreaming. Compare here:
51
51
// https://github.com/tailscale/tailscale/compare/main...coder:tailscale:main
52
- replace tailscale.com => github.com/coder/tailscale v1.1.1-0.20220907140144-9abacd14802f
52
+ replace tailscale.com => github.com/coder/tailscale v1.1.1-0.20220907193453-fb5ba5ab658d
53
53
54
54
require (
55
55
cdr.dev/slog v1.4.2-0.20220525200111-18dce5c2cd5f
Original file line number Diff line number Diff line change @@ -352,8 +352,8 @@ github.com/coder/glog v1.0.1-0.20220322161911-7365fe7f2cd1 h1:UqBrPWSYvRI2s5RtOu
352
352
github.com/coder/glog v1.0.1-0.20220322161911-7365fe7f2cd1 /go.mod h1:EWib/APOK0SL3dFbYqvxE3UYd8E6s1ouQ7iEp/0LWV4 =
353
353
github.com/coder/retry v1.3.0 h1:5lAAwt/2Cm6lVmnfBY7sOMXcBOwcwJhmV5QGSELIVWY =
354
354
github.com/coder/retry v1.3.0 /go.mod h1:tXuRgZgWjUnU5LZPT4lJh4ew2elUhexhlnXzrJWdyFY =
355
- github.com/coder/tailscale v1.1.1-0.20220907140144-9abacd14802f h1:iWOlTwTwh1hCr6I0D2bWFHKRaPb7PmcxPISFkkj3DdM =
356
- github.com/coder/tailscale v1.1.1-0.20220907140144-9abacd14802f /go.mod h1:MO+tWkQp2YIF3KBnnej/mQvgYccRS5Xk/IrEpZ4Z3BU =
355
+ github.com/coder/tailscale v1.1.1-0.20220907193453-fb5ba5ab658d h1:IQ8wJn8MfDS+sesYPpn3EDAyvoGMxFvyyE9uWtcfU6w =
356
+ github.com/coder/tailscale v1.1.1-0.20220907193453-fb5ba5ab658d /go.mod h1:MO+tWkQp2YIF3KBnnej/mQvgYccRS5Xk/IrEpZ4Z3BU =
357
357
github.com/coder/wireguard-go/tun/netstack v0.0.0-20220823170024-a78136eb0cab h1:9yEvRWXXfyKzXu8AqywCi+tFZAoqCy4wVcsXwuvZNMc =
358
358
github.com/coder/wireguard-go/tun/netstack v0.0.0-20220823170024-a78136eb0cab /go.mod h1:TCJ66NtXh3urJotTdoYQOHHkyE899vOQl5TuF+WLSes =
359
359
github.com/containerd/aufs v0.0.0-20200908144142-dab0cbea06f4 /go.mod h1:nukgQABAEopAHvB6j7cnP5zJ+/3aVcE7hCYqvIwAHyE =
Original file line number Diff line number Diff line change @@ -260,29 +260,38 @@ func (c *Conn) SetNodeCallback(callback func(node *Node)) {
260
260
DERPLatency : c .lastDERPLatency ,
261
261
}
262
262
}
263
+ // A send queue must be used so nodes are sent in order.
264
+ queue := make (chan * Node , 16 )
265
+ go func () {
266
+ for {
267
+ select {
268
+ case <- c .closed :
269
+ return
270
+ case node := <- queue :
271
+ callback (node )
272
+ }
273
+ }
274
+ }()
263
275
c .wireguardEngine .SetNetInfoCallback (func (ni * tailcfg.NetInfo ) {
264
276
c .lastMutex .Lock ()
265
277
c .lastPreferredDERP = ni .PreferredDERP
266
278
c .lastDERPLatency = ni .DERPLatency
267
279
node := makeNode ()
280
+ queue <- node
268
281
c .lastMutex .Unlock ()
269
- callback (node )
270
282
})
271
283
c .wireguardEngine .SetStatusCallback (func (s * wgengine.Status , err error ) {
272
284
if err != nil {
273
285
return
274
286
}
275
- endpoints := make ([]string , 0 , len (s .LocalAddrs ))
287
+ c .lastMutex .Lock ()
288
+ c .lastEndpoints = make ([]string , 0 , len (s .LocalAddrs ))
276
289
for _ , addr := range s .LocalAddrs {
277
- endpoints = append (endpoints , addr .Addr .String ())
290
+ c . lastEndpoints = append (c . lastEndpoints , addr .Addr .String ())
278
291
}
279
- go func () {
280
- c .lastMutex .Lock ()
281
- c .lastEndpoints = endpoints
282
- node := makeNode ()
283
- c .lastMutex .Unlock ()
284
- callback (node )
285
- }()
292
+ node := makeNode ()
293
+ queue <- node
294
+ c .lastMutex .Unlock ()
286
295
})
287
296
}
288
297
You can’t perform that action at this time.
0 commit comments