simplify SendMessage

Signed-off-by: Leo Chen <leo@harmony.one>
pull/280/head
Leo Chen 6 years ago
parent a9f0e22aa0
commit f189ba0183
  1. 7
      p2p/host/hostv2/hostv2.go

@ -1,7 +1,6 @@
package hostv2 package hostv2
import ( import (
"bufio"
"context" "context"
"fmt" "fmt"
@ -79,11 +78,9 @@ func (host *HostV2) SendMessage(p p2p.Peer, message []byte) error {
return err return err
} }
// Create a buffered stream so that read and writes are non blocking. defer s.Close()
w := bufio.NewWriter(s) s.Write(message)
// Create a thread to read and write data.
go writeData(w, message)
return nil return nil
} }

Loading…
Cancel
Save