mirror of
https://github.com/v2fly/v2ray-core.git
synced 2025-01-02 23:47:07 -05:00
allocate copyHandler on stack
This commit is contained in:
parent
ab87c240f7
commit
35129e6518
@ -103,11 +103,11 @@ func copyInternal(reader Reader, writer Writer, handler *copyHandler) error {
|
||||
|
||||
// Copy dumps all payload from reader to writer or stops when an error occurs. It returns nil when EOF.
|
||||
func Copy(reader Reader, writer Writer, options ...CopyOption) error {
|
||||
handler := new(copyHandler)
|
||||
var handler copyHandler
|
||||
for _, option := range options {
|
||||
option(handler)
|
||||
option(&handler)
|
||||
}
|
||||
err := copyInternal(reader, writer, handler)
|
||||
err := copyInternal(reader, writer, &handler)
|
||||
if err != nil && errors.Cause(err) != io.EOF {
|
||||
return err
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user