Add some debugging info to the client connection
This commit is contained in:
parent
4864669df6
commit
6ef0d6f1a5
|
@ -96,6 +96,7 @@ func (cr *ChatRoom) Join(name, uid string) (*Client, error) {
|
|||
}
|
||||
}
|
||||
|
||||
conn.clientName = name
|
||||
client := &Client{
|
||||
name: name,
|
||||
conn: conn,
|
||||
|
|
|
@ -12,6 +12,7 @@ type chatConnection struct {
|
|||
*websocket.Conn
|
||||
mutex sync.RWMutex
|
||||
forwardedFor string
|
||||
clientName string
|
||||
}
|
||||
|
||||
func (cc *chatConnection) ReadData(data interface{}) error {
|
||||
|
@ -29,7 +30,10 @@ func (cc *chatConnection) WriteData(data interface{}) error {
|
|||
stats.msgOutInc()
|
||||
err := cc.WriteJSON(data)
|
||||
if err != nil {
|
||||
return fmt.Errorf("Error writing data to %s: %v", cc.Host(), err)
|
||||
if operr, ok := err.(*net.OpError); ok {
|
||||
fmt.Println("OpError: " + operr.Err.Error())
|
||||
}
|
||||
return fmt.Errorf("Error writing data to %s %s: %v", cc.clientName, cc.Host(), err)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue