File was renamed from analysis/work/service/reciever.go |
| | |
| | | } |
| | | } |
| | | |
| | | // Run run task from ipc data |
| | | func (r *Reciever) Run(asServer bool) { |
| | | var i *ipc.IPC |
| | | if asServer { |
| | | i = ipc.NewServer(r.ctxIPC.ctx, r.ipcURL) |
| | | } else { |
| | | i = ipc.NewClient(r.ctxIPC.ctx, r.ipcURL) |
| | | } |
| | | |
| | | func (r *Reciever) run(i *ipc.IPC) { |
| | | dataChan := make(chan []byte) |
| | | go unserilizeImageInfo(dataChan, r.chImage) |
| | | |
| | | i.RecvToChannel(dataChan) |
| | | } |
| | | |
| | | // RunAsServer run a IPC server |
| | | func (r *Reciever) RunAsServer() { |
| | | r.run(ipc.NewServer(r.ctxIPC.ctx, r.ipcURL)) |
| | | |
| | | } |
| | | |
| | | // RunAsClient run as a IPC client |
| | | func (r *Reciever) RunAsClient() { |
| | | r.run(ipc.NewClient(r.ctxIPC.ctx, r.ipcURL)) |
| | | } |
| | | |
| | | // Stop stop reciever, run in goroutine |
| | | func (r *Reciever) Stop() { |
| | | if r.ctxIPC.cancel != nil { |