mirror of https://github.com/XTLS/Xray-core
splithttp Read() using blocking mode (#3473)
* blocking splithttp read * Add testcase * simplify conditions --------- Co-authored-by: mmmray <142015632+mmmray@users.noreply.github.com>pull/3479/head
parent
7acd5a623b
commit
e4f9d03bef
@ -0,0 +1,22 @@
|
||||
package splithttp_test
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/xtls/xray-core/common"
|
||||
. "github.com/xtls/xray-core/transport/internet/splithttp"
|
||||
)
|
||||
|
||||
func Test_regression_readzero(t *testing.T) {
|
||||
q := NewUploadQueue(10)
|
||||
q.Push(Packet{
|
||||
Payload: []byte("x"),
|
||||
Seq: 0,
|
||||
})
|
||||
buf := make([]byte, 20)
|
||||
n, err := q.Read(buf)
|
||||
common.Must(err)
|
||||
if n != 1 {
|
||||
t.Error("n=", n)
|
||||
}
|
||||
}
|
Loading…
Reference in new issue