Skip to content

Commit c8545bb

Browse files
committed
fixed panic for multiple hosts
1 parent 5011c66 commit c8545bb

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
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.3"
18+
const version = "heplify 1.66.4"
1919

2020
func createFlags() {
2121

publish/hep.go

+7
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import (
77
"net"
88
"os"
99
"runtime/debug"
10+
"strconv"
1011
"strings"
1112
"time"
1213
"unicode"
@@ -149,6 +150,12 @@ func (h *HEPOutputer) ReSendPingPacket() {
149150

150151
func (h *HEPOutputer) Send(msg []byte) {
151152
for n := range h.addr {
153+
154+
if h.client[n].conn == nil || h.client[n].writer == nil {
155+
logp.Debug("connection is not up, index: ", strconv.Itoa(n))
156+
continue
157+
}
158+
152159
h.client[n].writer.Write(msg)
153160
err := h.client[n].writer.Flush()
154161
if err != nil {

0 commit comments

Comments
 (0)