Skip to content

Commit

Permalink
Merge pull request #298 from sipcapture/fix_buffer
Browse files Browse the repository at this point in the history
Fix buffer
  • Loading branch information
adubovikov committed Aug 14, 2024
2 parents 6560c7c + bc9f7c3 commit 9d102bb
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
2 changes: 1 addition & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import (
"github.com/sipcapture/heplify/sniffer"
)

const version = "heplify 1.66.6"
const version = "heplify 1.66.7"

func createFlags() {

Expand Down
12 changes: 7 additions & 5 deletions publish/hep.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import (
"net"
"os"
"runtime/debug"
"strconv"
"strings"
"time"
"unicode"
Expand Down Expand Up @@ -152,13 +151,16 @@ func (h *HEPOutputer) Send(msg []byte) {
onceSent := false
for n := range h.addr {

var err error

if h.client[n].conn == nil || h.client[n].writer == nil {
logp.Debug("connection is not up, index: ", strconv.Itoa(n))
continue
logp.Debug("connection is not up", fmt.Sprintf("index: %d, Len: %d, once: %v", n, len(h.addr), onceSent))
err = fmt.Errorf("connection is broken")
} else {
h.client[n].writer.Write(msg)
err = h.client[n].writer.Flush()
}

h.client[n].writer.Write(msg)
err := h.client[n].writer.Flush()
if err != nil {
h.client[n].errCnt++
var retry bool
Expand Down

0 comments on commit 9d102bb

Please sign in to comment.