Skip to content

Instantly share code, notes, and snippets.

@ijingo
Created November 19, 2016 09:43
Show Gist options
  • Save ijingo/d563e6e523eabe543c25ae77cd780deb to your computer and use it in GitHub Desktop.
Save ijingo/d563e6e523eabe543c25ae77cd780deb to your computer and use it in GitHub Desktop.
func (mr *Master) Register(args *RegisterArgs, _ *struct{}) error {
mr.Lock()
defer mr.Unlock()
debug("Register: worker %s\n", args.Worker)
mr.workers = append(mr.workers, args.Worker)
go func() {
mr.registerChannel <- args.Worker
}()
return nil
}
func (mr *Master) Shutdown(_, _ *struct{}) error {
debug("Shutdown: registration server\n")
close(mr.shutdown)
mr.l.Close()
return nil
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment