[go-nuts] scanner.Scan is holding my goroutine ;(

2018-12-13 Thread Ivan Korjavin
I have a goroutenie with scanner.Scan It looks like: ``` cnn.SetReadDeadline(time.Now().Add(c.rTimeout)) // 10s scanner := bufio.NewScanner(cnn) for scanner.Scan() { ... } ``` cnn is a net.Conn there My problem is when I call cnn.Close() (and I tried cnn.SetReadDeadline(time.Now()) in addition

Re: [go-nuts] scanner.Scan is holding my goroutine ;(

2018-12-13 Thread Dan Kortschak
Can you wrap the call to scanner.Scan in a func that has access to the ccn context and returns false when it's closed? On Thu, 2018-12-13 at 14:04 -0800, Ivan Korjavin wrote: > I have a goroutenie with  scanner.Scan > It looks like: > > ``` > cnn.SetReadDeadline(time.Now().Add(c.rTimeout)) // 10s

Re: [go-nuts] scanner.Scan is holding my goroutine ;(

2018-12-13 Thread 'Kevin Malachowski' via golang-nuts
Can you post a short, self-contained (compile-able and runnable) example which shows the problem? Preferably hosted on play.golang.org for easy sharing and editing. If the scanner is reading from a reader which has been closed (returns io.EOF), the sc.Scan should return false (and the sc.Err wo