From b4be281671ecfe5c1e6f831614ca1dde48522cd7 Mon Sep 17 00:00:00 2001 From: jwijenbergh Date: Tue, 25 Oct 2022 11:44:04 +0200 Subject: Client + FSM: Remove background argument from transition This fixes a race condition reported by Go's -race flag In the future we should use waitgroups to ensure the OAuth local listener is started before we sent the URL --- internal/fsm/fsm.go | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) (limited to 'internal/fsm') diff --git a/internal/fsm/fsm.go b/internal/fsm/fsm.go index d5957b0..198d51a 100644 --- a/internal/fsm/fsm.go +++ b/internal/fsm/fsm.go @@ -110,7 +110,7 @@ func (fsm *FSM) GoBack() { fsm.GoTransition(fsm.States[fsm.Current].BackState) } -func (fsm *FSM) GoTransitionWithData(newState FSMStateID, data interface{}, background bool) bool { +func (fsm *FSM) GoTransitionWithData(newState FSMStateID, data interface{}) bool { ok := fsm.HasTransition(newState) if ok { @@ -120,18 +120,14 @@ func (fsm *FSM) GoTransitionWithData(newState FSMStateID, data interface{}, back fsm.writeGraph() } - if background { - go fsm.StateCallback(oldState, newState, data) - } else { - fsm.StateCallback(oldState, newState, data) - } + fsm.StateCallback(oldState, newState, data) } return ok } func (fsm *FSM) GoTransition(newState FSMStateID) bool { - return fsm.GoTransitionWithData(newState, "{}", false) + return fsm.GoTransitionWithData(newState, "{}") } func (fsm *FSM) generateMermaidGraph() string { -- cgit v1.2.3