go-coap icon indicating copy to clipboard operation
go-coap copied to clipboard

Shutdown waits for end of processing

Open ivajloip opened this issue 6 years ago • 2 comments

Hello,

Thank you very much for the excellent project! So far this is the best CoAP library that I have used!

I am using it for an application that I am creating and I started looking into the shutdown logic. From what I saw in the code, when the shutdown method is called, the listener stops accepting requests, but there is no guarantee that all the requests that are already accepted will finish their processing. I believe I can add logic in my handler type for keeping track of this, so that my application can call server.Shutdown() followed by handler.Close() and have a guarantee that all processing is over, but I thought the better approach might be if the server library takes care of it as other will face a similar problem.

I need to make sure all the processing is over as I don't want to exit the application and interrupt some processing that might result in inconsistent state.

Cheers,

ivajloip avatar May 22 '19 15:05 ivajloip

Hi. I think this is a good feature. If you have time could you create for that PR ? I will merge it. For now I'm very busy with OCF Cloud staff. Thx

jkralik avatar May 22 '19 19:05 jkralik

Hi,

Yes, I will try to do that one of those days.

Thanks,

ivajloip avatar May 23 '19 15:05 ivajloip