From 8c3d1360e1102bc05545fb9bcf06355276d46dd8 Mon Sep 17 00:00:00 2001
From: zhangmeng <775834166@qq.com>
Date: 星期二, 21 一月 2020 16:05:26 +0800
Subject: [PATCH] dispatch functions

---
 libcomm/notify.go |   10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/libcomm/notify.go b/libcomm/notify.go
index d930c6a..009e2e7 100644
--- a/libcomm/notify.go
+++ b/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

--
Gitblit v1.8.0