Closed phanhuynhquy closed 4 years ago
Found small issue when review in below function when stream's protocol is not registered before
func (h *channelHolder) incomingConnHandler(stream network.Stream) { h.muExpected.Lock() ch, ok := h.expectedPID[stream.Protocol()] if !ok { // => Missing unlock in this case return } h.muExpected.Unlock() ch <- stream }
Also consider function (c *channel) Send(ctx context.Context, bytes []byte) There is no mutex to protect in between two writes :
(c *channel) Send(ctx context.Context, bytes []byte)
if _, err := stream.Write(b); err != nil { return err } _, err := stream.Write(bytes) return err
fixed at https://github.com/berty/go-orbit-db/pull/67
Found small issue when review in below function when stream's protocol is not registered before
Also consider function
(c *channel) Send(ctx context.Context, bytes []byte)
There is no mutex to protect in between two writes :