call Stream.CloseWrite right after writing
This commit is contained in:
parent
425d8a7fcf
commit
6ae7cdab64
@ -430,6 +430,7 @@ func (c *client) sendRequestToPeer(ctx context.Context, peer peer.ID, req *Reque
|
||||
}
|
||||
_ = stream.SetWriteDeadline(time.Time{}) // clear deadline // FIXME: Needs
|
||||
// its own API (https://github.com/libp2p/go-libp2p/core/issues/162).
|
||||
stream.CloseWrite()
|
||||
|
||||
// Read response.
|
||||
var res Response
|
||||
|
@ -158,6 +158,7 @@ func (hs *Service) SayHello(ctx context.Context, pid peer.ID) error {
|
||||
if err := cborutil.WriteCborRPC(s, hmsg); err != nil {
|
||||
return xerrors.Errorf("writing rpc to peer: %w", err)
|
||||
}
|
||||
s.CloseWrite()
|
||||
|
||||
go func() {
|
||||
defer s.Close() //nolint:errcheck
|
||||
|
Loading…
Reference in New Issue
Block a user