ing
This commit is contained in:
parent
eccc5a4eec
commit
8436eb6f61
24
Gopkg.lock
generated
24
Gopkg.lock
generated
|
@ -18,12 +18,12 @@
|
|||
name = "git.loafle.net/commons/server-go"
|
||||
packages = [
|
||||
".",
|
||||
"client",
|
||||
"socket",
|
||||
"socket/client",
|
||||
"socket/web",
|
||||
"socket/web/client"
|
||||
]
|
||||
revision = "1cae23cf7819d56fd399346a1dc30af6a82d1a93"
|
||||
revision = "20a63b3de6efdc0942bfb4be21ddc64e2b76f59d"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
|
@ -72,7 +72,7 @@
|
|||
branch = "master"
|
||||
name = "git.loafle.net/overflow/gateway_rpc"
|
||||
packages = ["server"]
|
||||
revision = "1db82cb967f26a4cb4031e9fd8efe13031d1793c"
|
||||
revision = "b7d6a6fcb39be4e5a376c6db4fd8fe7d6a2fe6bc"
|
||||
|
||||
[[projects]]
|
||||
name = "github.com/BurntSushi/toml"
|
||||
|
@ -108,8 +108,8 @@
|
|||
"models",
|
||||
"pkg/escape"
|
||||
]
|
||||
revision = "89e084a80fb1e0bf5e7d38038e3367f821fdf3d7"
|
||||
version = "v1.5.3"
|
||||
revision = "4e4e00bc5ab85a3ff5e988c91020cf0399a87026"
|
||||
version = "v1.5.4"
|
||||
|
||||
[[projects]]
|
||||
name = "github.com/klauspost/compress"
|
||||
|
@ -118,8 +118,8 @@
|
|||
"gzip",
|
||||
"zlib"
|
||||
]
|
||||
revision = "6c8db69c4b49dd4df1fff66996cf556176d0b9bf"
|
||||
version = "v1.2.1"
|
||||
revision = "5fb1f31b0a61e9858f12f39266e059848a5f1cea"
|
||||
version = "v1.3.0"
|
||||
|
||||
[[projects]]
|
||||
name = "github.com/klauspost/cpuid"
|
||||
|
@ -127,12 +127,6 @@
|
|||
revision = "ae7887de9fa5d2db4eaa8174a7eff2c1ac00f2da"
|
||||
version = "v1.1"
|
||||
|
||||
[[projects]]
|
||||
name = "github.com/klauspost/crc32"
|
||||
packages = ["."]
|
||||
revision = "cb6bfca970f6908083f26f39a79009d608efd5cd"
|
||||
version = "v1.1"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
name = "github.com/segmentio/kafka-go"
|
||||
|
@ -185,7 +179,7 @@
|
|||
"internal/timeseries",
|
||||
"trace"
|
||||
]
|
||||
revision = "db08ff08e8622530d9ed3a0e8ac279f6d4c02196"
|
||||
revision = "4cb1c02c05b0e749b0365f61ae859a8e0cfceed9"
|
||||
|
||||
[[projects]]
|
||||
name = "golang.org/x/text"
|
||||
|
@ -212,7 +206,7 @@
|
|||
branch = "master"
|
||||
name = "google.golang.org/genproto"
|
||||
packages = ["googleapis/rpc/status"]
|
||||
revision = "32ee49c4dd805befd833990acba36cb75042378c"
|
||||
revision = "ff3583edef7de132f219f0efc00e097cabcc0ec0"
|
||||
|
||||
[[projects]]
|
||||
name = "google.golang.org/grpc"
|
||||
|
|
|
@ -14,7 +14,8 @@
|
|||
"pongTimeout": 60,
|
||||
"pingTimeout": 10,
|
||||
"pingPeriod": 9,
|
||||
"enableCompression": false
|
||||
"enableCompression": false,
|
||||
"compressionThreshold": 8192
|
||||
},
|
||||
"external": {
|
||||
"grpc": {
|
||||
|
|
|
@ -9,7 +9,7 @@ import (
|
|||
|
||||
logging "git.loafle.net/commons/logging-go"
|
||||
"git.loafle.net/commons/server-go"
|
||||
"git.loafle.net/commons/server-go/socket"
|
||||
css "git.loafle.net/commons/server-go/socket"
|
||||
cssw "git.loafle.net/commons/server-go/socket/web"
|
||||
occp "git.loafle.net/overflow/commons-go/config/probe"
|
||||
ocmd "git.loafle.net/overflow/commons-go/model/data"
|
||||
|
@ -88,7 +88,7 @@ func (s *DataServlets) Handshake(servletCtx server.ServletCtx, ctx *fasthttp.Req
|
|||
return nil, nil
|
||||
}
|
||||
|
||||
func (s *DataServlets) OnConnect(servletCtx server.ServletCtx, conn socket.Conn) {
|
||||
func (s *DataServlets) OnConnect(servletCtx server.ServletCtx, conn css.Conn) {
|
||||
s.Servlets.OnConnect(servletCtx, conn)
|
||||
}
|
||||
|
||||
|
@ -98,30 +98,34 @@ func (s *DataServlets) OnDisconnect(servletCtx server.ServletCtx) {
|
|||
|
||||
func (s *DataServlets) Handle(servletCtx server.ServletCtx,
|
||||
stopChan <-chan struct{}, doneChan chan<- struct{},
|
||||
readChan <-chan []byte, writeChan chan<- []byte) {
|
||||
readChan <-chan css.SocketMessage, writeChan chan<- css.SocketMessage) {
|
||||
defer func() {
|
||||
doneChan <- struct{}{}
|
||||
}()
|
||||
|
||||
var (
|
||||
err error
|
||||
// messageType int
|
||||
message []byte
|
||||
err error
|
||||
)
|
||||
|
||||
for {
|
||||
select {
|
||||
case msg, ok := <-readChan:
|
||||
case socketMessage, ok := <-readChan:
|
||||
if !ok {
|
||||
return
|
||||
}
|
||||
|
||||
_, message = socketMessage()
|
||||
|
||||
m := &ocmd.Metric{}
|
||||
err = json.Unmarshal(msg, m)
|
||||
err = json.Unmarshal(message, m)
|
||||
if nil != err {
|
||||
logging.Logger().Error(err)
|
||||
break
|
||||
}
|
||||
|
||||
err = oek.Write("metric", []byte(m.SensorConfigID), msg)
|
||||
err = oek.Write("metric", []byte(m.SensorConfigID), message)
|
||||
if nil != err {
|
||||
logging.Logger().Error(err)
|
||||
break
|
||||
|
|
Loading…
Reference in New Issue
Block a user