Added graceful stop for worker

This commit is contained in:
Dmitry Krylov 2022-01-03 21:25:22 +03:00
parent d36dcb7fc2
commit 2263172a84

View File

@ -219,6 +219,15 @@ func (worker *Worker) customeHandler(inpack *inPack) {
} }
} }
// Stop serving
func (worker *Worker) Stop() {
worker.Lock()
defer worker.Unlock()
if worker.running == true {
close(worker.in)
}
}
// Close connection and exit main loop // Close connection and exit main loop
func (worker *Worker) Close() { func (worker *Worker) Close() {
worker.Lock() worker.Lock()