<commit_before>// +build linux

package kcp

import (
	"sync/atomic"

	"github.com/pkg/errors"
	"golang.org/x/net/ipv4"
)

func (s *UDPSession) tx(txqueue []ipv4.Message) {
	nbytes := 0
	vec := txqueue
	for len(vec) > 0 {
		if n, err := s.bconn.WriteBatch(vec, 0); err == nil {
			vec = vec[n:]
		} else {
			s.socketError.Store(errors.WithStack(err))
			break
		}
	}

	for k := range txqueue {
		nbytes += len(txqueue[k].Buffers[0])
		xmitBuf.Put(txqueue[k].Buffers[0])
	}
	atomic.AddUint64(&DefaultSnmp.OutPkts, uint64(len(txqueue)))
	atomic.AddUint64(&DefaultSnmp.OutBytes, uint64(nbytes))
}<commit_msg>correct counting<commit_after>// +build linux

package kcp

import (
	"sync/atomic"

	"github.com/pkg/errors"
	"golang.org/x/net/ipv4"
)

func (s *UDPSession) tx(txqueue []ipv4.Message) {
	nbytes := 0
	npkts := 0
	for len(txqueue) > 0 {
		if n, err := s.bconn.WriteBatch(txqueue, 0); err == nil {
			for k := range txqueue[:n] {
				nbytes += len(txqueue[k].Buffers[0])
				xmitBuf.Put(txqueue[k].Buffers[0])
			}
			npkts += n
			txqueue = txqueue[n:]
		} else {
			s.socketError.Store(errors.WithStack(err))
			break
		}
	}

	atomic.AddUint64(&DefaultSnmp.OutPkts, uint64(npkts))
	atomic.AddUint64(&DefaultSnmp.OutBytes, uint64(nbytes))
}
{'fraction_non_alphanumeric': 0.1725521669341894, 'fraction_numerical': 0.024879614767255216, 'mean_word_length': 3.8333333333333335, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6736233', 'n_tokens_mistral': 583, 'n_tokens_neox': 526, 'n_words': 91}