Unverified Commit 4b9ee569 authored by Steven Allen's avatar Steven Allen Committed by GitHub

Merge pull request #99 from libp2p/fix/timeout-incoming-stream-reads

Fix: Stream read timeout
parents a1074536 e4c7f4cd
......@@ -17,6 +17,8 @@ import (
ma "github.com/multiformats/go-multiaddr"
)
var streamReadTimeout = 60 * time.Second
// AutoNATService provides NAT autodetection services to other peers
type autoNATService struct {
ctx context.Context
......@@ -48,6 +50,8 @@ func newAutoNATService(ctx context.Context, c *config) (*autoNATService, error)
}
func (as *autoNATService) handleStream(s network.Stream) {
s.SetReadDeadline(time.Now().Add(streamReadTimeout))
defer s.Close()
pid := s.Conn().RemotePeer()
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment