Skip to content

Commit

Permalink
increased the rotation frequency
Browse files Browse the repository at this point in the history
  • Loading branch information
caffix committed Aug 17, 2024
1 parent 56e946c commit b601bb4
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions conn.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ type connections struct {
}

func newConnections(cpus int, resps queue.Queue) *connections {
if cpus < 100 {
cpus = 100
}

conns := &connections{
resps: resps,
done: make(chan struct{}),
Expand Down Expand Up @@ -70,7 +74,7 @@ func (r *connections) Close() {
}

func (r *connections) rotations() {
t := time.NewTicker(30 * time.Second)
t := time.NewTicker(10 * time.Second)
defer t.Stop()

for {
Expand Down Expand Up @@ -142,7 +146,9 @@ func (r *connections) WriteMsg(msg *dns.Msg, addr net.Addr) error {

if conn := r.Next(); conn != nil {
_ = conn.SetWriteDeadline(time.Now().Add(500 * time.Millisecond))
if n, err = conn.WriteTo(out, addr); err == nil && n < len(out) {

n, err = conn.WriteTo(out, addr)
if err == nil && n < len(out) {
err = fmt.Errorf("only wrote %d bytes of the %d byte message", n, len(out))
}
}
Expand Down

0 comments on commit b601bb4

Please sign in to comment.