ing
This commit is contained in:
parent
c33a743a25
commit
5e3f820eb3
|
@ -3,7 +3,6 @@ package servlet
|
|||
import (
|
||||
"context"
|
||||
"crypto/rsa"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"sync"
|
||||
|
||||
|
@ -12,7 +11,6 @@ import (
|
|||
"git.loafle.net/commons/server-go"
|
||||
"git.loafle.net/commons/server-go/socket"
|
||||
ocpc "git.loafle.net/overflow/commons-go/probe/constants"
|
||||
ocpm "git.loafle.net/overflow/commons-go/probe/model"
|
||||
og "git.loafle.net/overflow/gateway"
|
||||
"git.loafle.net/overflow/gateway/external/grpc"
|
||||
ogrs "git.loafle.net/overflow/gateway_rpc/servlet"
|
||||
|
@ -80,25 +78,16 @@ func (s *DataServlets) Handshake(servletCtx server.ServletCtx, ctx *fasthttp.Req
|
|||
probeKey := string(bProbeKey)
|
||||
|
||||
grpcCTX := context.Background()
|
||||
r, err := grpc.Exec(grpcCTX, "ProbeService.readByProbeKey", probeKey)
|
||||
_, err := grpc.Exec(grpcCTX, "ProbeService.readByProbeKey", probeKey)
|
||||
if nil != err {
|
||||
return nil, fmt.Errorf("grpc call Error: %s", err.Error())
|
||||
}
|
||||
|
||||
probe := ocpm.Probe{}
|
||||
err = json.Unmarshal([]byte(r), probe)
|
||||
if nil != err {
|
||||
return nil, fmt.Errorf("grpc result unMarshal Error: %s", err.Error())
|
||||
}
|
||||
|
||||
extHeader := &fasthttp.ResponseHeader{}
|
||||
extHeader.Add(ocpc.HTTPResponseHeaderKey_Probe_SetEncryptionKey, probe.EncryptionKey)
|
||||
|
||||
servletCtx.SetAttribute(og.SessionIDKey, probe.ProbeKey)
|
||||
servletCtx.SetAttribute(og.SessionIDKey, probeKey)
|
||||
servletCtx.SetAttribute(og.SessionClientTypeKey, og.PROBE)
|
||||
servletCtx.SetAttribute(og.SessionTargetIDKey, probe.ProbeKey)
|
||||
servletCtx.SetAttribute(og.SessionTargetIDKey, probeKey)
|
||||
|
||||
return extHeader, nil
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
func (s *DataServlets) OnConnect(servletCtx server.ServletCtx, conn socket.Conn) {
|
||||
|
|
|
@ -89,7 +89,7 @@ func (s *ProbeServlets) Handshake(servletCtx server.ServletCtx, ctx *fasthttp.Re
|
|||
return nil, fmt.Errorf("grpc call Error: %s", err.Error())
|
||||
}
|
||||
|
||||
probe := ocpm.Probe{}
|
||||
probe := &ocpm.Probe{}
|
||||
err = json.Unmarshal([]byte(r), probe)
|
||||
if nil != err {
|
||||
return nil, fmt.Errorf("grpc result unMarshal Error: %s", err.Error())
|
||||
|
@ -98,9 +98,9 @@ func (s *ProbeServlets) Handshake(servletCtx server.ServletCtx, ctx *fasthttp.Re
|
|||
extHeader := &fasthttp.ResponseHeader{}
|
||||
extHeader.Add(ocpc.HTTPResponseHeaderKey_Probe_SetEncryptionKey, probe.EncryptionKey)
|
||||
|
||||
servletCtx.SetAttribute(og.SessionIDKey, probe.ProbeKey)
|
||||
servletCtx.SetAttribute(og.SessionIDKey, probeKey)
|
||||
servletCtx.SetAttribute(og.SessionClientTypeKey, og.PROBE)
|
||||
servletCtx.SetAttribute(og.SessionTargetIDKey, probe.ProbeKey)
|
||||
servletCtx.SetAttribute(og.SessionTargetIDKey, probeKey)
|
||||
|
||||
return extHeader, nil
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user