Skip to content

Commit

Permalink
Remove unneeded bytes.Reader.
Browse files Browse the repository at this point in the history
  • Loading branch information
lthibault committed Jun 1, 2024
1 parent 998d936 commit 083efd5
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions system/socket.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package system

import (
"bytes"
context "context"
"errors"
"io"
Expand All @@ -27,7 +26,7 @@ func (c SocketConfig) Build() (sock Socket) {

type Socket struct {
Deliver api.Function
Buffer io.Writer
Buffer io.Writer // bytes.Buffer
}

func (p Socket) Handle(ctx context.Context, call Proc_handle) error {
Expand All @@ -40,7 +39,7 @@ func (p Socket) Handle(ctx context.Context, call Proc_handle) error {
return err
}

n, err := io.Copy(p.Buffer, bytes.NewReader(b))
n, err := p.Buffer.Write(b)
if err != nil {
return err
} else if n > math.MaxUint32 {
Expand Down

0 comments on commit 083efd5

Please sign in to comment.