Currently, when you initialize the server. The Init method blocks until the server is terminated. However, this makes terminating the server programmatically difficult. Consider this example:
TcpServer server = new TcpServer(...);
server.Init();
server.Stop(); // <-- you never reach this
apart from this issue, there is also a papercut with the API:
Init. Is unintuitive. People will probably not expect this to actually start the server, maybe we can use a different name? (like Start?)
we need an alternative design to properly handle the lifetime of the server. We can use this issue for discussion.
Currently, when you initialize the server. The
Initmethod blocks until the server is terminated. However, this makes terminating the server programmatically difficult. Consider this example:apart from this issue, there is also a papercut with the API:
Init. Is unintuitive. People will probably not expect this to actually start the server, maybe we can use a different name? (likeStart?)we need an alternative design to properly handle the lifetime of the server. We can use this issue for discussion.