From 2d390df9ede39c9d7c34bd8190b9329cfc371325 Mon Sep 17 00:00:00 2001
From: zhangmeng <775834166@qq.com>
Date: 星期五, 27 九月 2019 16:19:05 +0800
Subject: [PATCH] remove exist ipc

---
 nng.go |    8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/nng.go b/nng.go
index fe82e3d..812cc37 100644
--- a/nng.go
+++ b/nng.go
@@ -49,10 +49,9 @@
 		time.Sleep(time.Duration(surveyorTime*2) * time.Second)
 	}
 
-	msg := mangos.NewMessage(len(data))
+	msg := mangos.NewMessage(1)
 	msg.Body = data
 	return n.sock.SendMsg(msg)
-
 }
 
 // Recv impl interface Diliver
@@ -82,7 +81,8 @@
 // Recv2 impl interface
 func (n *NNG) Recv2(data []byte) (l int, err error) {
 	data, err = n.Recv()
-	return len(data), err
+	l = len(data)
+	return l, err
 }
 
 // Close impl interface Deliver
@@ -148,6 +148,8 @@
 	if s[0] == "ipc" {
 		if _, err := os.Stat(s[1]); err == nil {
 			os.Remove(s[1])
+		} else if !os.IsNotExist(err) {
+			os.Remove(s[1])
 		}
 	}
 }

--
Gitblit v1.8.0