| | |
| | | } |
| | | } |
| | | |
| | | 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 |
| | |
| | | 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 |