Conversation
84909c1 to
fccc467
Compare
dc946ec to
a002a51
Compare
* remove returning error on multiple call to Serve(), callers never should do that. * remove TestServerServeAlreadyListening test.
a002a51 to
255c268
Compare
| go startServer(tcpServer) | ||
| go startServer(unixServer) | ||
|
|
||
| closing := make(chan struct{}, 2) |
There was a problem hiding this comment.
I'm not sure I understand how this is useful.
Why not doing something like
defer tcpService.Close()
defer unixServer.Close()instead of having to create this chan that we pass as a parameters of the closeServer we could close the server directly and not in some goroutines. I might be missing something here
There was a problem hiding this comment.
yes actually, that channel is needed. Close() will stop accepting incoming gRPC requests and gracefully wait current ones to end. so Close() will block until all accepted gRPC requests are done. We should only exit the program after both Close() calls has returned.
There was a problem hiding this comment.
and the reason why we use a goroutine and a chan is to close both server concurrently and don't force one to wait until another one closes.
related with #354 (comment)