Skip to content

Commit 9d102bb

Browse files
authored
Merge pull request #298 from sipcapture/fix_buffer
Fix buffer
2 parents 6560c7c + bc9f7c3 commit 9d102bb

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

main.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import (
1515
"github.com/sipcapture/heplify/sniffer"
1616
)
1717

18-
const version = "heplify 1.66.6"
18+
const version = "heplify 1.66.7"
1919

2020
func createFlags() {
2121

publish/hep.go

+7-5
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import (
77
"net"
88
"os"
99
"runtime/debug"
10-
"strconv"
1110
"strings"
1211
"time"
1312
"unicode"
@@ -152,13 +151,16 @@ func (h *HEPOutputer) Send(msg []byte) {
152151
onceSent := false
153152
for n := range h.addr {
154153

154+
var err error
155+
155156
if h.client[n].conn == nil || h.client[n].writer == nil {
156-
logp.Debug("connection is not up, index: ", strconv.Itoa(n))
157-
continue
157+
logp.Debug("connection is not up", fmt.Sprintf("index: %d, Len: %d, once: %v", n, len(h.addr), onceSent))
158+
err = fmt.Errorf("connection is broken")
159+
} else {
160+
h.client[n].writer.Write(msg)
161+
err = h.client[n].writer.Flush()
158162
}
159163

160-
h.client[n].writer.Write(msg)
161-
err := h.client[n].writer.Flush()
162164
if err != nil {
163165
h.client[n].errCnt++
164166
var retry bool

0 commit comments

Comments
 (0)