Merge pull request #4 from edjsu/fprintf-on-connections
Use fmt.Fprintf to write messages to client connections
This commit is contained in:
commit
888d9479f7
@ -303,10 +303,8 @@ func (c *Client) writeThread(signalChan chan signalCode, outputChan chan string)
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
case output := <-outputChan:
|
case output := <-outputChan:
|
||||||
line := []byte(fmt.Sprintf("%s\r\n", output))
|
|
||||||
|
|
||||||
c.connection.SetWriteDeadline(time.Now().Add(time.Second * 30))
|
c.connection.SetWriteDeadline(time.Now().Add(time.Second * 30))
|
||||||
if _, err := c.connection.Write(line); err != nil {
|
if _, err := fmt.Fprintf(c.connection, "%s\r\n", output); err != nil {
|
||||||
c.disconnect()
|
c.disconnect()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user