Unverified Commit 95e3edf3 authored by Hannah Howard's avatar Hannah Howard Committed by GitHub

Merge pull request #25 from ipfs/minor_fix_from_go_bitswap

fix(network): remove buffer
parents c932f96f 45f5c8cb
package network package network
import ( import (
"bufio"
"context" "context"
"fmt" "fmt"
"io" "io"
...@@ -64,11 +63,9 @@ func msgToStream(ctx context.Context, s inet.Stream, msg gsmsg.GraphSyncMessage) ...@@ -64,11 +63,9 @@ func msgToStream(ctx context.Context, s inet.Stream, msg gsmsg.GraphSyncMessage)
log.Warningf("error setting deadline: %s", err) log.Warningf("error setting deadline: %s", err)
} }
w := bufio.NewWriter(s)
switch s.Protocol() { switch s.Protocol() {
case ProtocolGraphsync: case ProtocolGraphsync:
if err := msg.ToNet(w); err != nil { if err := msg.ToNet(s); err != nil {
log.Debugf("error: %s", err) log.Debugf("error: %s", err)
return err return err
} }
...@@ -76,11 +73,6 @@ func msgToStream(ctx context.Context, s inet.Stream, msg gsmsg.GraphSyncMessage) ...@@ -76,11 +73,6 @@ func msgToStream(ctx context.Context, s inet.Stream, msg gsmsg.GraphSyncMessage)
return fmt.Errorf("unrecognized protocol on remote: %s", s.Protocol()) return fmt.Errorf("unrecognized protocol on remote: %s", s.Protocol())
} }
if err := w.Flush(); err != nil {
log.Debugf("error: %s", err)
return err
}
if err := s.SetWriteDeadline(time.Time{}); err != nil { if err := s.SetWriteDeadline(time.Time{}); err != nil {
log.Warningf("error resetting deadline: %s", err) log.Warningf("error resetting deadline: %s", err)
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment