Skip to content

Commit

Permalink
make copy buffer size a const
Browse files Browse the repository at this point in the history
Signed-off-by: Mark Pashmfouroush <[email protected]>
  • Loading branch information
markpash committed Sep 30, 2023
1 parent 4296174 commit 5a0d343
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion relay.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ import (
"strings"
)

const BUFFER_SIZE = 256 * 1024

type Server struct {
host string
port string
Expand Down Expand Up @@ -143,7 +145,7 @@ func (client *Client) handleRequest() {
// encountered. Copy uses a fixed-size buffer to efficiently copy data between
// the source and destination.
func Copy(src io.Reader, dst io.Writer) {
buf := make([]byte, 256*1024)
buf := make([]byte, BUFFER_SIZE)

_, err := io.CopyBuffer(dst, src, buf[:cap(buf)])
if err != nil {
Expand Down

0 comments on commit 5a0d343

Please sign in to comment.