Skip to content

Commit

Permalink
tidy
Browse files Browse the repository at this point in the history
  • Loading branch information
lesismal committed Oct 26, 2023
1 parent 0d9546c commit d00806b
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions nbhttp/processor.go
Original file line number Diff line number Diff line change
Expand Up @@ -266,14 +266,15 @@ func (p *ServerProcessor) OnComplete(parser *Parser) {
response := NewResponse(p.parser, request, p.enableSendfile)
if !parser.Execute(func() {
p.handler.ServeHTTP(response, request)
parser.hijacked = p.flushResponse(response)
p.flushResponse(response)
}) {
releaseRequest(request, p.parser.Engine.RetainHTTPBody)
}
}

func (p *ServerProcessor) flushResponse(res *Response) bool {
func (p *ServerProcessor) flushResponse(res *Response) {
hijacked := res.hijacked
p.parser.hijacked = hijacked
if p.conn != nil {
req := res.request
if !hijacked {
Expand All @@ -282,7 +283,7 @@ func (p *ServerProcessor) flushResponse(res *Response) bool {
p.conn.Close()
releaseRequest(req, p.parser.Engine.RetainHTTPBody)
releaseResponse(res)
return hijacked
return
}
if req.Close {
// the data may still in the send queue
Expand All @@ -294,7 +295,6 @@ func (p *ServerProcessor) flushResponse(res *Response) bool {
releaseRequest(req, p.parser.Engine.RetainHTTPBody)
releaseResponse(res)
}
return hijacked
}

// Close .
Expand Down

0 comments on commit d00806b

Please sign in to comment.