splithttp Read() using blocking mode#3473
Conversation
mmmray
left a comment
There was a problem hiding this comment.
I don't understand the reproduction steps. This hangs correctly:
func Test_readzero(t *testing.T) {
q := NewUploadQueue(10)
buf := make([]byte, 20)
n, err := q.Read(buf)
common.Must(err)
if n == 0 {
t.Error("n=0")
}
}
| if len(h.heap) == 0 { | ||
| packet, more := <-h.pushedPackets | ||
| if !more { | ||
| return 0, io.EOF |
There was a problem hiding this comment.
if EOF is handled here, I think line 50 can be removed? and then h.closed can be removed.
because h.pushedPackets is always closed when h.closed == true
Splithttp doesn't work with Trojan protocol, u can give it a try |
it hangs here but it returns 0 directly when h.pushedPackets gets data |
|
thanks, i realized it after you said trojan is broken, and pushed a unittest. I could not reproduce it with VLESS, only trojan. it seems httpupgrade might have a similar issue here (but for downloaded data)
|
mmmray
left a comment
There was a problem hiding this comment.
looks good but i don't dare to merge
|
Thanks guys for the great collaboration! @mmmray now that you can maintain xray-core,, you are welcomed to merge, at least with code you are familiar with :) |
|
Some points are:
|
* blocking splithttp read * Add testcase * simplify conditions --------- Co-authored-by: mmmray <142015632+mmmray@users.noreply.github.com>
* blocking splithttp read * Add testcase * simplify conditions --------- Co-authored-by: mmmray <142015632+mmmray@users.noreply.github.com>
splithttp的Read()应该使用阻塞模式,不然trojan和VLESS读取第一个数据包时会返回长度为0