mirror of
https://github.com/fhmq/hmq.git
synced 2026-08-29 22:13:11 +00:00
'fixtlsbug'
This commit is contained in:
+8
-11
@@ -96,19 +96,21 @@ func (b *Broker) wsHandler(ws *websocket.Conn) {
|
|||||||
go b.handleConnection(CLIENT, ws, b.cid)
|
go b.handleConnection(CLIENT, ws, b.cid)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (b *Broker) StartClientListening(tls bool) {
|
func (b *Broker) StartClientListening(Tls bool) {
|
||||||
var hp string
|
var hp string
|
||||||
if tls {
|
var err error
|
||||||
|
var l net.Listener
|
||||||
|
if Tls {
|
||||||
hp = b.config.TlsHost + ":" + b.config.TlsPort
|
hp = b.config.TlsHost + ":" + b.config.TlsPort
|
||||||
|
l, err = tls.Listen("tcp", hp, b.tlsConfig)
|
||||||
log.Info("Start TLS Listening client on ", hp)
|
log.Info("Start TLS Listening client on ", hp)
|
||||||
} else {
|
} else {
|
||||||
hp := b.config.Host + ":" + b.config.Port
|
hp := b.config.Host + ":" + b.config.Port
|
||||||
|
l, err = net.Listen("tcp", hp)
|
||||||
log.Info("Start Listening client on ", hp)
|
log.Info("Start Listening client on ", hp)
|
||||||
}
|
}
|
||||||
|
if err != nil {
|
||||||
l, e := net.Listen("tcp", hp)
|
log.Error("Error listening on ", err)
|
||||||
if e != nil {
|
|
||||||
log.Error("Error listening on ", e)
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
tmpDelay := 10 * ACCEPT_MIN_SLEEP
|
tmpDelay := 10 * ACCEPT_MIN_SLEEP
|
||||||
@@ -129,11 +131,6 @@ func (b *Broker) StartClientListening(tls bool) {
|
|||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
tmpDelay = ACCEPT_MIN_SLEEP
|
tmpDelay = ACCEPT_MIN_SLEEP
|
||||||
if tls {
|
|
||||||
if !b.Handshake(conn) {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
}
|
|
||||||
atomic.AddUint64(&b.cid, 1)
|
atomic.AddUint64(&b.cid, 1)
|
||||||
go b.handleConnection(CLIENT, conn, b.cid)
|
go b.handleConnection(CLIENT, conn, b.cid)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user