mirror of
https://git.maid.zone/stuff/soundcloak.git
synced 2025-12-10 13:49:39 +05:00
don't release req/resp in restream reader
This commit is contained in:
@@ -46,8 +46,13 @@ func clone(buf []byte) []byte {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (r *reader) Setup(url string, aac bool) error {
|
func (r *reader) Setup(url string, aac bool) error {
|
||||||
r.req = fasthttp.AcquireRequest()
|
if r.req == nil {
|
||||||
r.resp = fasthttp.AcquireResponse()
|
r.req = fasthttp.AcquireRequest()
|
||||||
|
}
|
||||||
|
|
||||||
|
if r.resp == nil {
|
||||||
|
r.resp = fasthttp.AcquireResponse()
|
||||||
|
}
|
||||||
|
|
||||||
r.req.SetRequestURI(url)
|
r.req.SetRequestURI(url)
|
||||||
r.req.Header.SetUserAgent(cfg.UserAgent)
|
r.req.Header.SetUserAgent(cfg.UserAgent)
|
||||||
@@ -106,15 +111,8 @@ func (r *reader) Setup(url string, aac bool) error {
|
|||||||
|
|
||||||
func (r *reader) Close() error {
|
func (r *reader) Close() error {
|
||||||
misc.Log("closed :D")
|
misc.Log("closed :D")
|
||||||
if r.req != nil {
|
r.req.Reset()
|
||||||
fasthttp.ReleaseRequest(r.req)
|
r.resp.Reset()
|
||||||
r.req = nil
|
|
||||||
}
|
|
||||||
|
|
||||||
if r.resp != nil {
|
|
||||||
fasthttp.ReleaseResponse(r.resp)
|
|
||||||
r.resp = nil
|
|
||||||
}
|
|
||||||
|
|
||||||
r.client = nil
|
r.client = nil
|
||||||
r.leftover = nil
|
r.leftover = nil
|
||||||
|
|||||||
Reference in New Issue
Block a user