mirror of
https://github.com/fhmq/hmq.git
synced 2026-09-01 15:24:53 +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() {
|
func (c *client) init() {
|
||||||
c.status = Connected
|
c.status = Connected
|
||||||
c.info.localIP, _, _ = net.SplitHostPort(c.conn.LocalAddr().String())
|
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.ctx, c.cancelFunc = context.WithCancel(context.Background())
|
||||||
c.subMap = make(map[string]*subscription)
|
c.subMap = make(map[string]*subscription)
|
||||||
c.topicsMgr = c.broker.topicsMgr
|
c.topicsMgr = c.broker.topicsMgr
|
||||||
|
|||||||
Reference in New Issue
Block a user