mirror of
https://github.com/fhmq/hmq.git
synced 2026-08-31 14:54:52 +00:00
do not try to set remoteIP for websocket connections (#81)
This commit is contained in:
+6
-1
@@ -94,7 +94,12 @@ var (
|
||||
func (c *client) init() {
|
||||
c.status = Connected
|
||||
c.info.localIP, _, _ = net.SplitHostPort(c.conn.LocalAddr().String())
|
||||
c.info.remoteIP, _, _ = net.SplitHostPort(c.conn.RemoteAddr().String())
|
||||
remoteAddr := c.conn.RemoteAddr()
|
||||
remoteNetwork := remoteAddr.Network()
|
||||
c.info.remoteIP = ""
|
||||
if remoteNetwork != "websocket" {
|
||||
c.info.remoteIP, _, _ = net.SplitHostPort(remoteAddr.String())
|
||||
}
|
||||
c.ctx, c.cancelFunc = context.WithCancel(context.Background())
|
||||
c.subMap = make(map[string]*subscription)
|
||||
c.topicsMgr = c.broker.topicsMgr
|
||||
|
||||
Reference in New Issue
Block a user