(from, to State, stateFn func())
| 145 | } |
| 146 | |
| 147 | func (b *BasicService) mustSwitchState(from, to State, stateFn func()) { |
| 148 | if ok, _ := b.switchState(from, to, stateFn); !ok { |
| 149 | panic("switchState failed") |
| 150 | } |
| 151 | } |
| 152 | |
| 153 | // This is the "main" method, that does most of the work of service. |
| 154 | // Service is in Starting state when this method runs. |