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

Loading…
Cancel
Save