fix(server.go) fix duplicate call of setState
Fix a bug introduced by race fix. The setState function will not be called if there is not state change.