Signed-off-by: Leo Chen <leo@harmony.one>
@ -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