From a8f0b8f39b03068426555b667e656430ef5a50c5 Mon Sep 17 00:00:00 2001 From: fangdingjun Date: Tue, 24 Jul 2018 11:29:44 +0800 Subject: [PATCH] return 0 on pull function when read error 0 indicates connection termination --- tls.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tls.go b/tls.go index 900fafc..5cfc3cb 100644 --- a/tls.go +++ b/tls.go @@ -384,7 +384,8 @@ func onDataReadCallback(d unsafe.Pointer, cbuf *C.char, bufLen C.int) C.int { n, err := conn.c.Read(buf) if err != nil { log.Println(err) - return -1 + // 0 indicates connection termination + return 0 } //cbuf2 := C.CBytes(buf[:n]) // d := C.CString(string(buf[:n]))