mirror of
https://github.com/giongto35/cloud-game.git
synced 2026-07-20 16:54:25 +00:00
Update test comments
This commit is contained in:
parent
69d80354a3
commit
01abdd2c1e
4 changed files with 13 additions and 5 deletions
|
|
@ -94,7 +94,7 @@ func initClient(t *testing.T, host string) (client *cws.Client) {
|
|||
fmt.Println("Waiting sdp...")
|
||||
|
||||
client.Receive("sdp", func(resp cws.WSPacket) cws.WSPacket {
|
||||
fmt.Println("received", resp.Data)
|
||||
log.Println("Received SDP", resp.Data, "client: ", client)
|
||||
answer := webrtc.SessionDescription{}
|
||||
gamertc.Decode(resp.Data, &answer)
|
||||
// Apply the answer as the remote description
|
||||
|
|
@ -254,6 +254,7 @@ func TestTwoServerOneOverlord(t *testing.T) {
|
|||
fmt.Println("Request the room from server 1", remoteRoomID)
|
||||
log.Println("Server2 trying to join server1 room")
|
||||
// After trying loging in to one session, login to other with the roomID
|
||||
bridgeRoom := make(chan string)
|
||||
client2.Send(cws.WSPacket{
|
||||
ID: "start",
|
||||
Data: "Contra.nes",
|
||||
|
|
@ -261,9 +262,14 @@ func TestTwoServerOneOverlord(t *testing.T) {
|
|||
PlayerIndex: 1,
|
||||
}, func(resp cws.WSPacket) {
|
||||
fmt.Println("RoomID:", resp.RoomID)
|
||||
roomID <- resp.RoomID
|
||||
bridgeRoom <- resp.RoomID
|
||||
})
|
||||
|
||||
respRoomID := <-bridgeRoom
|
||||
if respRoomID == "" {
|
||||
fmt.Println("The room ID should be equal to the saved room")
|
||||
t.Fail()
|
||||
}
|
||||
// If receive roomID, the server is running correctly
|
||||
time.Sleep(time.Second)
|
||||
fmt.Println("Done")
|
||||
|
|
|
|||
|
|
@ -138,6 +138,7 @@ func (c *Client) Listen() {
|
|||
for {
|
||||
_, rawMsg, err := c.conn.ReadMessage()
|
||||
if err != nil {
|
||||
log.Println("FAILED ")
|
||||
log.Println("[!] read:", err)
|
||||
// TODO: Check explicit disconnect error to break
|
||||
close(c.Done)
|
||||
|
|
|
|||
|
|
@ -127,7 +127,7 @@ func (s *Session) bridgeConnection(serverID string, gameName string, roomID stri
|
|||
|
||||
// Ask overlord to relay SDP packet to serverID
|
||||
resp.TargetHostID = serverID
|
||||
log.Println("Sending offer to overlord to relay message to target host", resp.TargetHostID, "with payload", resp)
|
||||
log.Println("Sending offer to overlord to relay message to target host", resp.TargetHostID, "with payload")
|
||||
remoteTargetSDP := s.OverlordClient.SyncSend(resp)
|
||||
log.Println("Got back remote host SDP, sending to browser")
|
||||
// Send back remote SDP of remote server to browser
|
||||
|
|
|
|||
|
|
@ -84,7 +84,7 @@ func (o *Server) WSO(w http.ResponseWriter, r *http.Request) {
|
|||
log.Println("Overlord: Received a relay sdp request from a host")
|
||||
// TODO: Abstract
|
||||
if resp.TargetHostID != serverID {
|
||||
log.Println("Overlord: Sending relay sdp to target host", resp)
|
||||
log.Println("Overlord: Sending relay sdp to target host")
|
||||
// relay SDP to target host and get back sdp
|
||||
// TODO: Async
|
||||
sdp := o.servers[resp.TargetHostID].SyncSend(
|
||||
|
|
@ -114,7 +114,8 @@ func (o *Server) WSO(w http.ResponseWriter, r *http.Request) {
|
|||
log.Println("Overlord: Received a relay start request from a host")
|
||||
// TODO: Abstract
|
||||
if resp.TargetHostID != serverID {
|
||||
// relay SDP to target host and get back sdp
|
||||
// relay start to target host
|
||||
log.Println("Sending to target host", resp.TargetHostID, " ", resp)
|
||||
// TODO: Async
|
||||
resp := o.servers[resp.TargetHostID].SyncSend(
|
||||
resp,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue