Fixes #29
Code has been changed to separate server status from current available server. This lets us even add easily other different portals if needed, or add/remove server statuses easily.
Vars to check now are:
server.Current (can be None, Management, Operational)
server.State (can be Stopped, Starting, Running, Stopping)
While starting any server a goroutine checks if the server is already started (by telnet host:port) and moves state from Starting to Running when available.
Server starts asynchronously, so that if you check state just after listenAndServe() call, maybe you still don't get desired server status as it is still in startup process. In case you want main thread to wait for certain server state, there is a server.WaitForState() available method
A bunch of new tests have been added to verify the correct state after valid or invalid transitions.
Fixes #29 Code has been changed to separate server status from current available server. This lets us even add easily other different portals if needed, or add/remove server statuses easily.
Vars to check now are:
While starting any server a goroutine checks if the server is already started (by telnet host:port) and moves state from Starting to Running when available. Server starts asynchronously, so that if you check state just after listenAndServe() call, maybe you still don't get desired server status as it is still in startup process. In case you want main thread to wait for certain server state, there is a server.WaitForState() available method
A bunch of new tests have been added to verify the correct state after valid or invalid transitions.