Skip to content

Commit 49cb73a

Browse files
committed
rename var
1 parent c30986f commit 49cb73a

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

readloop_linux.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ func (s *UDPSession) readLoop() {
2020
}
2121

2222
for {
23-
if count, err := s.bconn.ReadBatch(msgs, 0); err == nil {
23+
if count, err := s.xconn.ReadBatch(msgs, 0); err == nil {
2424
for i := 0; i < count; i++ {
2525
msg := &msgs[i]
2626
// make sure the packet is from the same source
@@ -49,11 +49,11 @@ func (s *UDPSession) readLoop() {
4949
// monitor incoming data for all connections of server
5050
func (l *Listener) monitor() {
5151
addr, _ := net.ResolveUDPAddr("udp", l.conn.LocalAddr().String())
52-
var conn batchConn
52+
var xconn batchConn
5353
if addr.IP.To4() != nil {
54-
conn = ipv4.NewPacketConn(l.conn)
54+
xconn = ipv4.NewPacketConn(l.conn)
5555
} else {
56-
conn = ipv6.NewPacketConn(l.conn)
56+
xconn = ipv6.NewPacketConn(l.conn)
5757
}
5858

5959
msgs := make([]ipv4.Message, batchSize)
@@ -62,7 +62,7 @@ func (l *Listener) monitor() {
6262
}
6363

6464
for {
65-
if count, err := conn.ReadBatch(msgs, 0); err == nil {
65+
if count, err := xconn.ReadBatch(msgs, 0); err == nil {
6666
for i := 0; i < count; i++ {
6767
msg := &msgs[i]
6868
if msg.N >= l.headerSize+IKCP_OVERHEAD {

sess.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ type (
9898

9999
// packets waiting to be sent on wire
100100
txqueue []ipv4.Message
101-
bconn batchConn // for casting of batchConn
101+
xconn batchConn // for x/net
102102

103103
mu sync.Mutex
104104
}
@@ -131,9 +131,9 @@ func newUDPSession(conv uint32, dataShards, parityShards int, l *Listener, conn
131131
// cast to writebatch conn
132132
addr, _ := net.ResolveUDPAddr("udp", conn.LocalAddr().String())
133133
if addr.IP.To4() != nil {
134-
sess.bconn = ipv4.NewPacketConn(conn)
134+
sess.xconn = ipv4.NewPacketConn(conn)
135135
} else {
136-
sess.bconn = ipv6.NewPacketConn(conn)
136+
sess.xconn = ipv6.NewPacketConn(conn)
137137
}
138138

139139
// FEC codec initialization

tx_linux.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ func (s *UDPSession) tx(txqueue []ipv4.Message) {
1313
nbytes := 0
1414
npkts := 0
1515
for len(txqueue) > 0 {
16-
if n, err := s.bconn.WriteBatch(txqueue, 0); err == nil {
16+
if n, err := s.xconn.WriteBatch(txqueue, 0); err == nil {
1717
for k := range txqueue[:n] {
1818
nbytes += len(txqueue[k].Buffers[0])
1919
xmitBuf.Put(txqueue[k].Buffers[0])

0 commit comments

Comments
 (0)