mirror of
https://github.com/TeaOSLab/EdgeAdmin.git
synced 2025-11-08 16:00:26 +08:00
修复无法启动安装的Bug
This commit is contained in:
@@ -12,18 +12,11 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type SessionManager struct {
|
type SessionManager struct {
|
||||||
life uint
|
life uint
|
||||||
rpcClient *rpc.RPCClient
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewSessionManager() (*SessionManager, error) {
|
func NewSessionManager() (*SessionManager, error) {
|
||||||
rpcClient, err := rpc.SharedRPC()
|
return &SessionManager{}, nil
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
return &SessionManager{
|
|
||||||
rpcClient: rpcClient,
|
|
||||||
}, nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *SessionManager) Init(config *actions.SessionConfig) {
|
func (this *SessionManager) Init(config *actions.SessionConfig) {
|
||||||
@@ -38,7 +31,12 @@ func (this *SessionManager) Read(sid string) map[string]string {
|
|||||||
|
|
||||||
var result = map[string]string{}
|
var result = map[string]string{}
|
||||||
|
|
||||||
resp, err := this.rpcClient.LoginSessionRPC().FindLoginSession(this.rpcClient.Context(0), &pb.FindLoginSessionRequest{Sid: sid})
|
rpcClient, err := rpc.SharedRPC()
|
||||||
|
if err != nil {
|
||||||
|
return map[string]string{}
|
||||||
|
}
|
||||||
|
|
||||||
|
resp, err := rpcClient.LoginSessionRPC().FindLoginSession(rpcClient.Context(0), &pb.FindLoginSessionRequest{Sid: sid})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logs.Println("SESSION", "read '"+sid+"' failed: "+err.Error())
|
logs.Println("SESSION", "read '"+sid+"' failed: "+err.Error())
|
||||||
return result
|
return result
|
||||||
@@ -63,7 +61,12 @@ func (this *SessionManager) WriteItem(sid string, key string, value string) bool
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
_, err := this.rpcClient.LoginSessionRPC().WriteLoginSessionValue(this.rpcClient.Context(0), &pb.WriteLoginSessionValueRequest{
|
rpcClient, err := rpc.SharedRPC()
|
||||||
|
if err != nil {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
_, err = rpcClient.LoginSessionRPC().WriteLoginSessionValue(rpcClient.Context(0), &pb.WriteLoginSessionValueRequest{
|
||||||
Sid: sid,
|
Sid: sid,
|
||||||
Key: key,
|
Key: key,
|
||||||
Value: value,
|
Value: value,
|
||||||
@@ -81,7 +84,11 @@ func (this *SessionManager) Delete(sid string) bool {
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
_, err := this.rpcClient.LoginSessionRPC().DeleteLoginSession(this.rpcClient.Context(0), &pb.DeleteLoginSessionRequest{Sid: sid})
|
rpcClient, err := rpc.SharedRPC()
|
||||||
|
if err != nil {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
_, err = rpcClient.LoginSessionRPC().DeleteLoginSession(rpcClient.Context(0), &pb.DeleteLoginSessionRequest{Sid: sid})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logs.Println("SESSION", "delete '"+sid+"' failed: "+err.Error())
|
logs.Println("SESSION", "delete '"+sid+"' failed: "+err.Error())
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user