mirror of
https://github.com/ergochat/ergo.git
synced 2024-12-22 10:42:52 +01:00
don't close socket channels to avoid panics
This commit is contained in:
parent
db0f494604
commit
3fd73e3252
@ -13,7 +13,6 @@ func StringReadChan(conn net.Conn) <-chan string {
|
||||
ch := make(chan string)
|
||||
reader := bufio.NewReader(conn)
|
||||
go func() {
|
||||
defer close(ch)
|
||||
for {
|
||||
line, err := reader.ReadString('\n')
|
||||
if err != nil {
|
||||
@ -46,7 +45,6 @@ func StringWriteChan(conn net.Conn) chan<- string {
|
||||
ch := make(chan string)
|
||||
writer := bufio.NewWriter(conn)
|
||||
go func() {
|
||||
defer close(ch)
|
||||
for str := range ch {
|
||||
if DEBUG_NET {
|
||||
log.Printf("%s ← %s %s", conn.RemoteAddr(), conn.LocalAddr(), str)
|
||||
|
Loading…
Reference in New Issue
Block a user