This commit is contained in:
crusader 2018-07-01 02:43:56 +09:00
parent 8a0bee1589
commit 56914142e9
5 changed files with 24 additions and 27 deletions

29
Gopkg.lock generated
View File

@ -17,22 +17,23 @@
branch = "master" branch = "master"
name = "git.loafle.net/commons/rpc-go" name = "git.loafle.net/commons/rpc-go"
packages = [ packages = [
"codec",
"protocol", "protocol",
"protocol/json" "protocol/json"
] ]
revision = "dcc3af07239b3f6fcbae3529bcb52c522b02053d" revision = "b834f36e2bdb7e5ff93e83ab165ee0310895f6e7"
[[projects]] [[projects]]
branch = "master" branch = "master"
name = "git.loafle.net/commons/server-go" name = "git.loafle.net/commons/server-go"
packages = [ packages = [
".", ".",
"client",
"socket", "socket",
"socket/client",
"socket/web", "socket/web",
"socket/web/client" "socket/web/client"
] ]
revision = "1cae23cf7819d56fd399346a1dc30af6a82d1a93" revision = "20a63b3de6efdc0942bfb4be21ddc64e2b76f59d"
[[projects]] [[projects]]
branch = "master" branch = "master"
@ -97,7 +98,7 @@
"server", "server",
"servlet" "servlet"
] ]
revision = "1db82cb967f26a4cb4031e9fd8efe13031d1793c" revision = "b7d6a6fcb39be4e5a376c6db4fd8fe7d6a2fe6bc"
[[projects]] [[projects]]
name = "github.com/BurntSushi/toml" name = "github.com/BurntSushi/toml"
@ -133,8 +134,8 @@
"models", "models",
"pkg/escape" "pkg/escape"
] ]
revision = "89e084a80fb1e0bf5e7d38038e3367f821fdf3d7" revision = "4e4e00bc5ab85a3ff5e988c91020cf0399a87026"
version = "v1.5.3" version = "v1.5.4"
[[projects]] [[projects]]
name = "github.com/klauspost/compress" name = "github.com/klauspost/compress"
@ -143,8 +144,8 @@
"gzip", "gzip",
"zlib" "zlib"
] ]
revision = "6c8db69c4b49dd4df1fff66996cf556176d0b9bf" revision = "5fb1f31b0a61e9858f12f39266e059848a5f1cea"
version = "v1.2.1" version = "v1.3.0"
[[projects]] [[projects]]
name = "github.com/klauspost/cpuid" name = "github.com/klauspost/cpuid"
@ -152,12 +153,6 @@
revision = "ae7887de9fa5d2db4eaa8174a7eff2c1ac00f2da" revision = "ae7887de9fa5d2db4eaa8174a7eff2c1ac00f2da"
version = "v1.1" version = "v1.1"
[[projects]]
name = "github.com/klauspost/crc32"
packages = ["."]
revision = "cb6bfca970f6908083f26f39a79009d608efd5cd"
version = "v1.1"
[[projects]] [[projects]]
branch = "master" branch = "master"
name = "github.com/segmentio/kafka-go" name = "github.com/segmentio/kafka-go"
@ -210,7 +205,7 @@
"internal/timeseries", "internal/timeseries",
"trace" "trace"
] ]
revision = "db08ff08e8622530d9ed3a0e8ac279f6d4c02196" revision = "4cb1c02c05b0e749b0365f61ae859a8e0cfceed9"
[[projects]] [[projects]]
name = "golang.org/x/text" name = "golang.org/x/text"
@ -237,7 +232,7 @@
branch = "master" branch = "master"
name = "google.golang.org/genproto" name = "google.golang.org/genproto"
packages = ["googleapis/rpc/status"] packages = ["googleapis/rpc/status"]
revision = "32ee49c4dd805befd833990acba36cb75042378c" revision = "ff3583edef7de132f219f0efc00e097cabcc0ec0"
[[projects]] [[projects]]
name = "google.golang.org/grpc" name = "google.golang.org/grpc"
@ -280,6 +275,6 @@
[solve-meta] [solve-meta]
analyzer-name = "dep" analyzer-name = "dep"
analyzer-version = 1 analyzer-version = 1
inputs-digest = "358adc51841b70f9d6056cdf8c5790f3c0870c94503977ff3dafdca7d9ff921d" inputs-digest = "fedd80cb0ce2ca6815c9abe9cb0ccdc29e4636282126e3142a7f9d70f19a39b5"
solver-name = "gps-cdcl" solver-name = "gps-cdcl"
solver-version = 1 solver-version = 1

View File

@ -14,7 +14,8 @@
"pongTimeout": 60, "pongTimeout": 60,
"pingTimeout": 10, "pingTimeout": 10,
"pingPeriod": 9, "pingPeriod": 9,
"enableCompression": false "enableCompression": false,
"compressionThreshold": 8192
}, },
"external": { "external": {
"grpc": { "grpc": {

View File

@ -1,6 +1,7 @@
package server package server
import ( import (
crc "git.loafle.net/commons/rpc-go/codec"
crpj "git.loafle.net/commons/rpc-go/protocol/json" crpj "git.loafle.net/commons/rpc-go/protocol/json"
cssw "git.loafle.net/commons/server-go/socket/web" cssw "git.loafle.net/commons/server-go/socket/web"
"git.loafle.net/overflow/probe_gateway_rpc/config" "git.loafle.net/overflow/probe_gateway_rpc/config"
@ -8,7 +9,7 @@ import (
) )
func New(_config *config.Config) *cssw.Server { func New(_config *config.Config) *cssw.Server {
rpcServerCodec := crpj.NewServerCodec() rpcServerCodec := crpj.NewCustomServerCodec(crc.NewCompressionCodecSelector(_config.ServerHandler.GetCompressionThreshold()))
as := &servlet.AuthServlets{} as := &servlet.AuthServlets{}
as.RPCServerCodec = rpcServerCodec as.RPCServerCodec = rpcServerCodec

View File

@ -13,7 +13,7 @@ import (
"git.loafle.net/commons/logging-go" "git.loafle.net/commons/logging-go"
"git.loafle.net/commons/server-go" "git.loafle.net/commons/server-go"
"git.loafle.net/commons/server-go/socket" css "git.loafle.net/commons/server-go/socket"
occn "git.loafle.net/overflow/commons-go/config/noauthprobe" occn "git.loafle.net/overflow/commons-go/config/noauthprobe"
ocmm "git.loafle.net/overflow/commons-go/model/meta" ocmm "git.loafle.net/overflow/commons-go/model/meta"
ocmn "git.loafle.net/overflow/commons-go/model/noauthprobe" ocmn "git.loafle.net/overflow/commons-go/model/noauthprobe"
@ -165,7 +165,7 @@ func (s *AuthServlets) Handshake(servletCtx server.ServletCtx, ctx *fasthttp.Req
} }
} }
func (s *AuthServlets) OnConnect(servletCtx server.ServletCtx, conn socket.Conn) { func (s *AuthServlets) OnConnect(servletCtx server.ServletCtx, conn css.Conn) {
s.RPCServlets.OnConnect(servletCtx, conn) s.RPCServlets.OnConnect(servletCtx, conn)
_tempProbeKey := servletCtx.GetAttribute(og.SessionIDKey) _tempProbeKey := servletCtx.GetAttribute(og.SessionIDKey)
@ -216,8 +216,8 @@ LOOP:
for _, session := range sessions { for _, session := range sessions {
_writeChan := session.ServletCtx.GetAttribute(og.SessionWriteChanKey) _writeChan := session.ServletCtx.GetAttribute(og.SessionWriteChanKey)
if nil != _writeChan { if nil != _writeChan {
writeChan := _writeChan.(chan<- []byte) writeChan := _writeChan.(chan<- css.SocketMessage)
writeChan <- *msg.Message writeChan <- css.MakeSocketMessage(css.TextMessage, *msg.Message)
} }
} }
} }

View File

@ -9,7 +9,7 @@ import (
"git.loafle.net/commons/logging-go" "git.loafle.net/commons/logging-go"
"git.loafle.net/commons/server-go" "git.loafle.net/commons/server-go"
"git.loafle.net/commons/server-go/socket" css "git.loafle.net/commons/server-go/socket"
occp "git.loafle.net/overflow/commons-go/config/probe" occp "git.loafle.net/overflow/commons-go/config/probe"
ocmp "git.loafle.net/overflow/commons-go/model/probe" ocmp "git.loafle.net/overflow/commons-go/model/probe"
oe "git.loafle.net/overflow/external-go" oe "git.loafle.net/overflow/external-go"
@ -107,7 +107,7 @@ func (s *ProbeServlets) Handshake(servletCtx server.ServletCtx, ctx *fasthttp.Re
return extHeader, nil return extHeader, nil
} }
func (s *ProbeServlets) OnConnect(servletCtx server.ServletCtx, conn socket.Conn) { func (s *ProbeServlets) OnConnect(servletCtx server.ServletCtx, conn css.Conn) {
s.RPCServlets.OnConnect(servletCtx, conn) s.RPCServlets.OnConnect(servletCtx, conn)
_probeKey := servletCtx.GetAttribute(og.SessionIDKey) _probeKey := servletCtx.GetAttribute(og.SessionIDKey)
@ -159,8 +159,8 @@ LOOP:
for _, session := range sessions { for _, session := range sessions {
_writeChan := session.ServletCtx.GetAttribute(og.SessionWriteChanKey) _writeChan := session.ServletCtx.GetAttribute(og.SessionWriteChanKey)
if nil != _writeChan { if nil != _writeChan {
writeChan := _writeChan.(chan<- []byte) writeChan := _writeChan.(chan<- css.SocketMessage)
writeChan <- *msg.Message writeChan <- css.MakeSocketMessage(css.TextMessage, *msg.Message)
} }
} }