Merge pull request #3363 from aws-lumberyard-dev/remote_console_fix

Adds a verification response for the remote console connecting
This commit is contained in:
Sean Sweeney
2021-08-24 11:12:30 -07:00
committed by GitHub
4 changed files with 14 additions and 11 deletions
@@ -383,6 +383,13 @@ void SRemoteClient::Run()
bool ok = true;
bool autoCompleteDoneSent = false;
// Send a message that is used to verify that the Remote Console connected
SNoDataEvent<eCET_ConnectMessage> connectMessage;
SRemoteEventFactory::GetInst()->WriteToBuffer(&connectMessage, szBuff, size, kDefaultBufferSize);
ok &= SendPackage(szBuff, size);
ok &= RecvPackage(szBuff, size);
ok &= m_pServer->ReadBuffer(szBuff, size);
while (ok)
{
// read data
@@ -531,6 +538,7 @@ SRemoteEventFactory::SRemoteEventFactory()
REGISTER_EVENT_NODATA(eCET_Strobo_FrameInfoStart);
REGISTER_EVENT_STRING(eCET_Strobo_FrameInfoAdd);
REGISTER_EVENT_NODATA(eCET_ConnectMessage);
}
/////////////////////////////////////////////////////////////////////////////////////////////
@@ -60,6 +60,7 @@ enum EConsoleEventType
eCET_Strobo_FrameInfoStart,
eCET_Strobo_FrameInfoAdd,
eCET_ConnectMessage,
};
struct SRemoteEventFactory;
@@ -27,7 +27,8 @@ CONSOLE_MESSAGE_MAP = {
'COMMAND': BASE_MSG_TYPE + 5,
'AUTOCOMPLETELIST': BASE_MSG_TYPE + 6,
'AUTOCOMPLETELISTDONE': BASE_MSG_TYPE + 7,
'GAMEPLAYEVENT': BASE_MSG_TYPE + 22
'GAMEPLAYEVENT': BASE_MSG_TYPE + 22,
'CONNECTMESSAGE': BASE_MSG_TYPE + 25,
}
@@ -295,14 +296,7 @@ class RemoteConsole:
self.handlers[key].set()
continue
# The very first connection using the socket will return all of the auto complete items, turned off so no one
# wouldn't need to see them
elif message_type == CONSOLE_MESSAGE_MAP['AUTOCOMPLETELIST']:
pass
# The after the autocompletelists finishes we will be ready to send console commands we determine that by
# looking at for an autocompletelistdone message
elif message_type == CONSOLE_MESSAGE_MAP['AUTOCOMPLETELISTDONE']:
elif message_type == CONSOLE_MESSAGE_MAP['CONNECTMESSAGE']:
self.ready.set()
# cleanup expect_log_line handers if the matching string was found or timeout happened.
@@ -141,11 +141,11 @@ class TestRemoteConsole():
@mock.patch('socket.socket', mock.MagicMock())
@mock.patch('ly_remote_console.remote_console_commands.threading', mock.MagicMock())
def test_HandleMessage_AutoCompleteListDone_ReadySet(self):
def test_HandleMessage_ConnectMessage_ReadySet(self):
rc_instance = remote_console.RemoteConsole()
rc_instance.on_display = mock.MagicMock()
rc_instance.ready = mock.MagicMock()
msg = b'70' # in python3 socket.recv returns byte array. 7 is AUTOCOMPLETELISTDONE
msg = b'I0' # in python3 socket.recv returns byte array. I is CONNECTMESSAGE
rc_instance._handle_message(msg)