Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: Socket Support on Web #70

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open

Conversation

14h4i
Copy link

@14h4i 14h4i commented Mar 23, 2023

I modified ssh_socket_js.dart and it maybe work for web.

However, I am having problems in:

void _handleMessage(Uint8List message) {
final messageId = SSHMessage.readMessageId(message);
switch (messageId) {
case SSH_Message_KexInit.messageId:
return _handleMessageKexInit(message);
case SSH_Message_KexDH_Reply.messageId:
case SSH_Message_KexDH_GexReply.messageId:
return _handleMessageKexReply(message);
case SSH_Message_NewKeys.messageId:
return _handleMessageNewKeys(message);
default:
onPacket?.call(message);
}
}

and
void _dispatchMessage(Uint8List message) {
final messageId = SSHMessage.readMessageId(message);
switch (messageId) {
case SSH_Message_Service_Accept.messageId:
return _handleServiceAccept(message);
case SSH_Message_Userauth_Success.messageId:
return _handleUserauthSuccess();
case SSH_Message_Userauth_Failure.messageId:
return _handleUserauthFailure(message);
case SSH_Message_Userauth_Passwd_ChangeReq.messageId:
return _handleUserauthIntermidiate(message);
case SSH_Message_Userauth_Banner.messageId:
return _handleUserauthBanner(message);
case SSH_Message_Global_Request.messageId:
return _handleGlobalRequest(message);
case SSH_Message_Request_Success.messageId:
return _handleGlobalRequestSuccess(message);
case SSH_Message_Request_Failure.messageId:
return _handleGlobalRequestFailure(message);
case SSH_Message_Channel_Open.messageId:
return _handleChannelOpen(message);
case SSH_Message_Channel_Confirmation.messageId:
return _handleChannelConfirmation(message);
case SSH_Message_Channel_Open_Failure.messageId:
return _handleChannelOpenFailure(message);
case SSH_Message_Channel_Window_Adjust.messageId:
return _handleChannelWindowAdjust(message);
case SSH_Message_Channel_Success.messageId:
return _handleChannelSuccess(message);
case SSH_Message_Channel_Failure.messageId:
return _handleChannelFailure(message);
case SSH_Message_Channel_Data.messageId:
return _handleChannelData(message);
case SSH_Message_Channel_Extended_Data.messageId:
return _handleChannelExtendedData(message);
case SSH_Message_Channel_EOF.messageId:
return _handleChannelEOF(message);
case SSH_Message_Channel_Close.messageId:
return _handleChannelClose(message);
case SSH_Message_Channel_Request.messageId:
return _handleChannelRequest(message);
default:
printDebug?.call('unknown messageId: $messageId');
}
}

When run web with after modified, there is a case messageId return with value 30 and it seems that the case has not been handled. It caused the code to stop, when use SSHClient.shell :

await _authenticated.future;

@xtyxtyx Can you help me to handle it. I don't know the logic of this part code.

@14h4i 14h4i closed this Mar 23, 2023
@14h4i 14h4i reopened this Mar 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants