mirror of
https://github.com/fhmq/hmq.git
synced 2026-05-04 07:08:32 +00:00
some modify
This commit is contained in:
@@ -7,6 +7,7 @@ import (
|
||||
"fmt"
|
||||
"net"
|
||||
"net/http"
|
||||
_ "net/http/pprof"
|
||||
"runtime/debug"
|
||||
"sync"
|
||||
"sync/atomic"
|
||||
@@ -153,6 +154,16 @@ func (b *Broker) Start() {
|
||||
//system monitor
|
||||
go StateMonitor()
|
||||
|
||||
if b.config.Debug {
|
||||
startPProf()
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
func startPProf() {
|
||||
go func() {
|
||||
http.ListenAndServe(":10060", nil)
|
||||
}()
|
||||
}
|
||||
|
||||
func StateMonitor() {
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
/* Copyright (c) 2018, joy.zhou <chowyu08@gmail.com>
|
||||
*/
|
||||
package broker
|
||||
|
||||
import "github.com/eclipse/paho.mqtt.golang/packets"
|
||||
|
||||
@@ -1,17 +1,3 @@
|
||||
// Copyright (c) 2014 The SurgeMQ Authors. All rights reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package sessions
|
||||
|
||||
import (
|
||||
|
||||
10
main.go
10
main.go
@@ -7,7 +7,7 @@ copyright notice and this permission notice appear in all copies.
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"log"
|
||||
"os"
|
||||
"os/signal"
|
||||
"runtime"
|
||||
@@ -19,19 +19,17 @@ func main() {
|
||||
runtime.GOMAXPROCS(runtime.NumCPU())
|
||||
config, err := broker.ConfigureConfig(os.Args[1:])
|
||||
if err != nil {
|
||||
fmt.Println("configure broker config error: ", err)
|
||||
return
|
||||
log.Fatal("configure broker config error: ", err)
|
||||
}
|
||||
|
||||
b, err := broker.NewBroker(config)
|
||||
if err != nil {
|
||||
fmt.Println("New Broker error: ", err)
|
||||
return
|
||||
log.Fatal("New Broker error: ", err)
|
||||
}
|
||||
b.Start()
|
||||
|
||||
s := waitForSignal()
|
||||
fmt.Println("signal received, broker closed.", s)
|
||||
log.Println("signal received, broker closed.", s)
|
||||
}
|
||||
|
||||
func waitForSignal() os.Signal {
|
||||
|
||||
Reference in New Issue
Block a user