Refactor invitation handling in router.go
Some checks failed
continuous-integration/drone/push Build is failing
Some checks failed
continuous-integration/drone/push Build is failing
This commit is contained in:
parent
db4c3cbbc8
commit
defafcf996
12
doc/sq_srvinv01.puml
Normal file
12
doc/sq_srvinv01.puml
Normal file
@ -0,0 +1,12 @@
|
||||
@startuml Server Invitation Step 01
|
||||
User -> Bastet : fill invitation
|
||||
User -> Bastet : select servers
|
||||
Bastet -> NativeLib : get server cards for selected uids
|
||||
NativeLib -> Bastet : server cards
|
||||
Bastet -> NativeLib : invitationCreateMessage
|
||||
NativeLib -> Bastet : invitationMessage
|
||||
Bastet -> Server : send invitation
|
||||
Server -> Redis : Store invitation
|
||||
Server -> Bastet : invitation URL
|
||||
Bastet -> User : invitation URL
|
||||
@enduml
|
11
doc/sq_srvinv02.puml
Normal file
11
doc/sq_srvinv02.puml
Normal file
@ -0,0 +1,11 @@
|
||||
@startuml Server Invitation Step 02
|
||||
User -> Bastet : paste URL
|
||||
Bastet -> NativeLib : build invitationGetMessage
|
||||
NativeLib -> Bastet : invitationGetMessage
|
||||
Bastet -> Server : send invitationGetMessage
|
||||
Redis -> Server : retrieve invitation
|
||||
Server -> Bastet : invitation message
|
||||
Bastet -> NativeLib : please invitation message
|
||||
NativeLib -> Bastet : invitation message
|
||||
Bastet -> User : invitation data
|
||||
@enduml
|
12
doc/sq_srvinv03.puml
Normal file
12
doc/sq_srvinv03.puml
Normal file
@ -0,0 +1,12 @@
|
||||
|
||||
@startuml Server Invitation Step 03
|
||||
User -> Bastet : select servers
|
||||
User -> Bastet : accept invitation
|
||||
Bastet -> NativeLib : accept invitation
|
||||
Bastet -> NativeLib : build accept message
|
||||
NativeLib -> Bastet : invitationGetMessage
|
||||
Bastet -> Server : send accept message
|
||||
Server -> Redis : store accept message
|
||||
Server -> Bastet : accept message ok
|
||||
Bastet -> User : msg sent
|
||||
@enduml
|
10
doc/sq_srvinv04.puml
Normal file
10
doc/sq_srvinv04.puml
Normal file
@ -0,0 +1,10 @@
|
||||
|
||||
@startuml Server Invitation Step 03
|
||||
Bastet -> NativeLib : periodic message check
|
||||
Bastet -> NativeLib : build accept message
|
||||
NativeLib -> Bastet : invitationGetMessage
|
||||
Bastet -> Server : send accept message
|
||||
Server -> Redis : store accept message
|
||||
Server -> Bastet : accept message ok
|
||||
Bastet -> User : msg sent
|
||||
@enduml
|
@ -141,17 +141,22 @@ func (r *RedisRouter) Route(msg *meowlib.ToServerMessage) (*meowlib.FromServerMe
|
||||
from_server.Invitation.Payload = invitation // protobuf invitation
|
||||
}
|
||||
|
||||
/* should not happen
|
||||
case 3: // answer invitation
|
||||
expiry := r.AnswerInvitation(msg.Invitation.Id, int(msg.Invitation.Timeout), msg.Invitation.Payload, r.InvitationTimeout)
|
||||
from_server.Invitation.Expiry = expiry.UTC().Unix()
|
||||
case 4: // get answer
|
||||
answer, err := r.GetInvitationAnswer(msg.Invitation.Id)
|
||||
if err != nil {
|
||||
from_server.Invitation.Payload = []byte("invitation expired")
|
||||
} else {
|
||||
from_server.Invitation.Payload = answer
|
||||
}
|
||||
case 3: // answer invitation
|
||||
// just propagate the source publickey
|
||||
from_server.Invitation.From = msg.Invitation.From
|
||||
|
||||
//! store answer !!
|
||||
from_server.Invitation.Payload = msg.Invitation.Payload
|
||||
/*
|
||||
expiry := r.AnswerInvitation(msg.Invitation.Id, int(msg.Invitation.Timeout), msg.Invitation.Payload, r.InvitationTimeout)
|
||||
from_server.Invitation.Expiry = expiry.UTC().Unix()
|
||||
case 4: // get answer
|
||||
answer, err := r.GetInvitationAnswer(msg.Invitation.Id)
|
||||
if err != nil {
|
||||
from_server.Invitation.Payload = []byte("invitation expired")
|
||||
} else {
|
||||
from_server.Invitation.Payload = answer
|
||||
}
|
||||
*/
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user