Write correct IP in WriteData() error
Return the correct IP address on error during chatConnection.WirteData(). If the server is behind a reverse proxy, the connection object will have "127.0.0.1" as the remote address.
This commit is contained in:
parent
f36a51bf2b
commit
c0d3731b84
|
@ -1,6 +1,7 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"net"
|
||||
"sync"
|
||||
|
||||
|
@ -26,7 +27,11 @@ func (cc *chatConnection) WriteData(data interface{}) error {
|
|||
defer cc.mutex.Unlock()
|
||||
|
||||
stats.msgOutInc()
|
||||
return cc.WriteJSON(data)
|
||||
err := cc.WriteJSON(data)
|
||||
if err != nil {
|
||||
return fmt.Errorf("Error writing data to %s: %v", cc.Host(), err)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (cc *chatConnection) Host() string {
|
||||
|
|
Loading…
Reference in New Issue