fix: tuicv5 panic in ReadFrom
This commit is contained in:
parent
233eeb0b38
commit
ee3213c28f
1 changed files with 4 additions and 4 deletions
|
@ -96,10 +96,10 @@ func (q *quicStreamPacketConn) SetWriteDeadline(t time.Time) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (q *quicStreamPacketConn) ReadFrom(p []byte) (n int, addr net.Addr, err error) {
|
func (q *quicStreamPacketConn) ReadFrom(p []byte) (n int, addr net.Addr, err error) {
|
||||||
if q.inputConn != nil {
|
if inputConn := q.inputConn; inputConn != nil { // copy inputConn avoid be nil in for loop
|
||||||
for {
|
for {
|
||||||
var packet Packet
|
var packet Packet
|
||||||
packet, err = ReadPacket(q.inputConn)
|
packet, err = ReadPacket(inputConn)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -116,10 +116,10 @@ func (q *quicStreamPacketConn) ReadFrom(p []byte) (n int, addr net.Addr, err err
|
||||||
}
|
}
|
||||||
|
|
||||||
func (q *quicStreamPacketConn) WaitReadFrom() (data []byte, put func(), addr net.Addr, err error) {
|
func (q *quicStreamPacketConn) WaitReadFrom() (data []byte, put func(), addr net.Addr, err error) {
|
||||||
if q.inputConn != nil {
|
if inputConn := q.inputConn; inputConn != nil { // copy inputConn avoid be nil in for loop
|
||||||
for {
|
for {
|
||||||
var packet Packet
|
var packet Packet
|
||||||
packet, err = ReadPacket(q.inputConn)
|
packet, err = ReadPacket(inputConn)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue