Yeah, for Close() on TLS connections you want to set a write deadline before calling Close().
//jb > On 9 Feb 2017, at 10:28, liuding...@gmail.com wrote: > > OH sorry. it seems has some wrong in my demo code. it should import > "crypto/tls". So Close() is in crypto/tls/conn.go. > And i found it blocked in "c.handshakeMutex.Lock()". I suspect that someone > goroutine blocked in "c.sendAlert(alertCloseNotify)", case it`s an network > IO, and i didn`t setDeadLine(). > But i want to hold the Close() by self timer, than is it a wrong usage? > > 在 2017年2月8日星期三 UTC+8下午9:29:13,liudi...@gmail.com写道: > go version: 1.7.4 > OS: debian > code like: https://play.golang.org/p/DMIrSr2PLg > > this project just like IM, there are both goroutine for each client > connection, one to Read, another to Write. > recently i found conn.Close() (line 9) occasional block while high > concurrency, then there are a large of ESTABLISHED status connections, and > they won`t closed forever. Unless i restart the program > So In what case will it block? > > -- > You received this message because you are subscribed to the Google Groups > "golang-nuts" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to golang-nuts+unsubscr...@googlegroups.com. > For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.