-
Notifications
You must be signed in to change notification settings - Fork 4.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
splithttp Read() using blocking mode #3473
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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)
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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>
splithttp的Read()应该使用阻塞模式,不然trojan和VLESS读取第一个数据包时会返回长度为0