|
|
|
@ -164,10 +164,22 @@ func(server *Server) run() {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
session.remote = client_addr
|
|
|
|
|
server.Log("Got SESSION_CONNECT for client %s at address %s", session.Peer, session.remote)
|
|
|
|
|
|
|
|
|
|
server.Log("Got SESSION_CONNECT for session %s at address %s", session.ID, session.remote)
|
|
|
|
|
|
|
|
|
|
// TODO: Send server hello back
|
|
|
|
|
server_hello, err := NewSessionData(session, []byte("hello"))
|
|
|
|
|
if err != nil {
|
|
|
|
|
server.Log("Error generating server hello: %s", err)
|
|
|
|
|
continue
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
_, err = server.connection.WriteToUDP(server_hello, session.remote)
|
|
|
|
|
if err != nil {
|
|
|
|
|
server.Log("Error sending server hello: %s", err)
|
|
|
|
|
continue
|
|
|
|
|
}
|
|
|
|
|
server.Log("Sent server_hello for %s", session.ID)
|
|
|
|
|
|
|
|
|
|
case SESSION_CLOSE:
|
|
|
|
|
session_id := SessionID(buf[COMMAND_LENGTH:COMMAND_LENGTH+ID_LENGTH])
|
|
|
|
|
session, exists := server.sessions[session_id]
|
|
|
|
|