Skip to content

Commit 5bf0cbb

Browse files
committed
ipn/wg: update status iff not latest
1 parent 9c6195b commit 5bf0cbb

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

intra/ipn/wgproxy.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1675,13 +1675,13 @@ func (h *wgtun) listener(op wg.PktDir, err error) (ended bool) {
16751675

16761676
defer func() {
16771677
h.statusReason.Store(why)
1678-
updated := cur != s
1678+
updatedlatest := cur == s // cur is same as s, so h.status is already updated to latest
16791679
ended = s == END
1680-
if !updated {
1681-
updated = h.status.Cas(cur, s)
1680+
if !updatedlatest {
1681+
updatedlatest = h.status.Cas(cur, s)
16821682
}
1683-
logeif(!updated)("wg: %s listener: %s; status %s => %s; transition? %t, statusupdated? %t, why: %s",
1684-
h.tag(), op, pxstatus(cur), pxstatus(s), cur != s, !updated, why)
1683+
logeif(!updatedlatest)("wg: %s listener: %s; status %s => %s; transition? %t, statusupdated? %t, why: %s",
1684+
h.tag(), op, pxstatus(cur), pxstatus(s), cur != s, !updatedlatest, why)
16851685
}()
16861686

16871687
if op == wg.Clo {

0 commit comments

Comments
 (0)