soheilhy / cmux

Connection multiplexer for GoLang: serve different services on the same port!
Apache License 2.0
2.53k stars 197 forks source link

Add CMux.Close() to shutdown server #69

Closed jan25 closed 3 years ago

jan25 commented 5 years ago

We don't have a nice way to close CMux server. This PR adds a Close method that tries to gracefully stop cmux server.

Related issue: https://github.com/soheilhy/cmux/issues/39

sword-jin commented 4 years ago

@jan25 wow,why not author merge? ci wrong?

jan25 commented 4 years ago

@rrylee Let me fix the CI and do few tests when i get a chance. Also i don't have Merge rights, so owners of this repo suggestions on this PR? @soheilhy

Krithika3 commented 4 years ago

@jan25 is there a chance this can be merged?

jan25 commented 4 years ago

Hi @Krithika3. I can only try to finish up this PR. I will need maintainers help to review and merge as i don't have the rights. Looks like the last release was more than 2yrs ago, so not sure if this will ever be merged.

stoksc commented 3 years ago

@soheilhy Any way to get this merged? https://github.com/grpc/grpc-go expects calls to Accept to unblock whenever the listeners its using are closed, but since cmux doesn't it Stop/GracefulStop block forever. (or something like, reading all this code for the first time and my head hurts, sorry lol)

soheilhy commented 3 years ago

Hey sorry for the delay. @jan25 can you please add a test for this? otherwise, looks ok.

jan25 commented 3 years ago

@soheilhy thanks. I'll finalize this PR soon

vchudnov-g commented 3 years ago

@jan25 This PR will be very useful! Do you have an ETA for getting it finished? Thanks for your work on this!

jan25 commented 3 years ago

Sorry for late response. I have to fix/add tests, i'll spend some time this week to finish.

jan25 commented 3 years ago

I've added tests and fixed other breaking tests. @soheilhy could you please review?

soheilhy commented 3 years ago

Looks great. Thank you for adding the tests!

zhangqibupt commented 3 years ago

So glad to see this great prgress, do we have a plan to draft a new release?