tcp_server icon indicating copy to clipboard operation
tcp_server copied to clipboard

Difficulties integrating into an existing application

Open tech10 opened this issue 4 years ago • 0 comments

There will be some difficulties with integration of this library into another application.

At the moment, it is written in such a way that the library is strictly used for creating a TCP server only. However, I could see instances where one might desire to integrate this library into another application. There are some problems with its current implementation.

  • The library implements its own logging, and will shut down the entire program if an error is received that prevents the server from starting. Some programs might want to log data and shut down themselves in a clean, controlled manner. This library prevents this from occurring properly.
  • There is no way to stop a server once it's started. If a program integrating this library is intercepting process signals, or is otherwise being shut down through another means, the server won't close cleanly in a controlled manner that will stop accepting connections, clients, disconnect all clients, and terminate all running goroutines the server has spawned. The server will remain active and the goroutine to accept connections, at the very least, will still be operational.

Changes to the server might create some breaking changes to clients relying on it for use, such as if they expect the server to stop the program if it can't initialize, something that isn't wise programming. All go programs should handle errors in a controlled manner.

I would propose these issues at the minimum be addressed, so as to allow for integration of this library into existing applications, as well as to allow for the program to log its own errors properly.

tech10 avatar Mar 17 '21 01:03 tech10