zhangmeng
2020-01-21 8c3d1360e1102bc05545fb9bcf06355276d46dd8
libcomm/notify.go
@@ -81,11 +81,16 @@
   }
}
func getIPCURL(id string) string {
   return `ipc:///tmp/` + id + `.ipc`
}
// Notify master sync notify to slave
func Notify(ctx context.Context, url string, ch <-chan []byte, fn func(...interface{})) context.CancelFunc {
   rctx, cancel := context.WithCancel(ctx)
   sock := request(url, 2, fn)
   ipcURL := getIPCURL(url)
   sock := request(ipcURL, 2, fn)
   go notify(rctx, sock, ch, fn)
   return cancel
@@ -176,7 +181,8 @@
func Notifiee(ctx context.Context, url string, ch chan<- []byte, fn func(...interface{})) context.CancelFunc {
   rctx, cancel := context.WithCancel(ctx)
   sock := reply(url, 2, fn)
   ipcURL := getIPCURL(url)
   sock := request(ipcURL, 2, fn)
   go notifiee(rctx, sock, ch, fn)
   return cancel