mirror of
https://github.com/fhmq/hmq.git
synced 2026-08-29 14:03:10 +00:00
Rmoeve unnecessary type convert (#134)
This commit is contained in:
+4
-4
@@ -289,7 +289,7 @@ func (b *Broker) handleConnection(typ int, conn net.Conn) {
|
||||
return
|
||||
}
|
||||
|
||||
if typ == CLIENT && !b.CheckConnectAuth(string(msg.ClientIdentifier), string(msg.Username), string(msg.Password)) {
|
||||
if typ == CLIENT && !b.CheckConnectAuth(msg.ClientIdentifier, msg.Username, string(msg.Password)) {
|
||||
connack.ReturnCode = packets.ErrRefusedNotAuthorised
|
||||
func() {
|
||||
defer conn.Close()
|
||||
@@ -360,8 +360,8 @@ func (b *Broker) handleConnection(typ int, conn net.Conn) {
|
||||
b.OnlineOfflineNotification(cid, true)
|
||||
{
|
||||
b.Publish(&bridge.Elements{
|
||||
ClientID: string(msg.ClientIdentifier),
|
||||
Username: string(msg.Username),
|
||||
ClientID: msg.ClientIdentifier,
|
||||
Username: msg.Username,
|
||||
Action: bridge.Connect,
|
||||
Timestamp: time.Now().Unix(),
|
||||
})
|
||||
@@ -600,7 +600,7 @@ func (b *Broker) BroadcastSubOrUnsubMessage(packet packets.ControlPacket) {
|
||||
}
|
||||
|
||||
func (b *Broker) removeClient(c *client) {
|
||||
clientId := string(c.info.clientID)
|
||||
clientId := c.info.clientID
|
||||
typ := c.typ
|
||||
switch typ {
|
||||
case CLIENT:
|
||||
|
||||
+1
-2
@@ -159,7 +159,6 @@ func LoadConfig(filename string) (*Config, error) {
|
||||
return &config, nil
|
||||
}
|
||||
|
||||
|
||||
func (p *Plugins) UnmarshalJSON(b []byte) error {
|
||||
var named NamedPlugins
|
||||
err := json.Unmarshal(b, &named)
|
||||
@@ -235,7 +234,7 @@ func NewTLSConfig(tlsInfo TLSInfo) (*tls.Config, error) {
|
||||
return nil, err
|
||||
}
|
||||
pool := x509.NewCertPool()
|
||||
ok := pool.AppendCertsFromPEM([]byte(rootPEM))
|
||||
ok := pool.AppendCertsFromPEM(rootPEM)
|
||||
if !ok {
|
||||
return nil, fmt.Errorf("failed to parse root ca certificate")
|
||||
}
|
||||
|
||||
@@ -55,7 +55,7 @@ func (this *Session) Init(msg *packets.ConnectPacket) error {
|
||||
|
||||
this.topics = make(map[string]byte, 1)
|
||||
|
||||
this.id = string(msg.ClientIdentifier)
|
||||
this.id = msg.ClientIdentifier
|
||||
|
||||
this.initted = true
|
||||
|
||||
|
||||
Reference in New Issue
Block a user