mirror of
https://github.com/1Remote/1Remote.git
synced 2026-04-25 21:46:00 +03:00
[GH-ISSUE #869] Switching between main to alternative addresses - is not done upon disconnecting #704
Labels
No labels
area-configuration
area-ct-app
area-ct-rdp
area-ct-remoteapp
area-ct-ssh
area-ct-vnc
area-launcher
area-list
area-tags
area-teamwork
bug
chore
dependencies
general-build/ci
general-performance
general-refactor
general-security
general-supportive
general-ux
meta-documentation
meta-enhancement
meta-enhancement
meta-feature
meta-help-wanted
meta-unknown-error
priority-hi
priority-low
pull-request
question
resolution-duplicate
resolution-invalid
resolution-wontfix
stale
task-put-off
task-still-considering
task-working-in-progress
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/1Remote#704
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @rafi-d on GitHub (Feb 20, 2025).
Original GitHub issue: https://github.com/1Remote/1Remote/issues/869
Originally assigned to: @VShawn on GitHub.
RE-connection is always done to the last active address. So, when switching from main to alternative address - it will never re-connect.
In my case there is a wired and Wifi connections to the same LAPTOP/PC, with different IPs. When docking the PC again, it does not re-connect to the new address automatically.
@itagagaki commented on GitHub (Feb 25, 2025):
As for the RDP reconnect, it may be difficult to intervene because MSTSCLib does it, not 1Remote?
@rafi-d commented on GitHub (Feb 25, 2025):
But isn't the first connection and address selection done by your app? Can't you intervean in this case and take control?
@itagagaki commented on GitHub (Feb 25, 2025):
Oh, were you referring to the behavior of this?
@VShawn commented on GitHub (Feb 26, 2025):
No, we cannot control the address when the reconnection is initiated by RDP automaticly.
@rafi-d commented on GitHub (Feb 26, 2025):
Yeah, and RDP re-tries the current address only. But you can control
Yes, this is a good place for the app do the testing/trying both addresses. like you do on the first connection (double click) .
BUT I was actually referring to the time after RDP does its 3-5 retries and disconnects . At his point you might still be able to try re-connect to both addresses.
@itagagaki commented on GitHub (Feb 26, 2025):
Okay.
The RDP library will internally retry to reconnect 5 times. 1Remote has no control over this behavior.
(As an aside, it is not impossible to extend 1Remote to specify whether retries are enabled or not, and the maximum number of retries. Currently, nothing is specified, so the default is 5 retries).
You are talking about how 1Remote tries to reconnect afterwards, right? I am not sure if it should automatically reconnect at that point (I tried it on my end, but 1Remote crashed. This is another issue. It may be my local problem...), but I think it's up to the product owner, @VShawn, to decide whether to automatically reconnect at this point, and if so, whether to try the last active connection (which may be an alternative), or start with the root setup.
@rafi-d commented on GitHub (Feb 26, 2025):
Correct. Up to you to decide if to retry the alternate / main (other) connection at this point, if one is defined. This was the idea.
Same goes for the "reconnnect" menu item.
@VShawn commented on GitHub (Feb 27, 2025):
It is clear that automatically determining the available address during reconnection is a better user experience. I vote for it.
Annd we only need to keep the current manual reconnect button, since RDP is already capable of automatic reconnect.
@itagagaki commented on GitHub (Mar 5, 2025):
Once connected to the alternate host, it seems to always connect to the alternate host, not to the primary host, even if the primary host is subsequently available for connection. When Automatic address switching is unchecked, it connects to the primary host, but when Automatic address switching is checked, it still connects to the alternate host.
@VShawn commented on GitHub (Mar 5, 2025):
@itagagaki can you help debugging to verify if it first checks the primary address and then the backup address during reconn? I busy tonight.
set breakpoint here:
https://github.com/1Remote/1Remote/blob/main/Ui/Service/SessionControlService_AlternateCredential.cs#L254-L266
where
var ret = await TcpHelper.TestConnectionAsync(newCredential.Address, newCredential.Port, null, 100);is to first checks the primary address, Here we need to check if the main address is correct.then
var connectableAddress = await FindFirstConnectableAddressAsync(credentials, protocol.DisplayName);is to find from credentials to get first credential that responds to the ping.note that I have reset the main address to its default value at this location: https://github.com/1Remote/1Remote/blob/main/Ui/Service/SessionControlService_AlternateCredential.cs#L216-L221
But if you are busy too, I will test tomorrow. :)
@itagagaki commented on GitHub (Mar 5, 2025):
When "Automatic address switching" is checked, the
TestConnectionAsynccall with the primary host address asnewCredential.Addressreturns false.Then
FindFirstConnectableAddressAsyncreturns an object with the alternate address.However, the first time I tried it after reading your instructions,
FindFirstConnectableAddressAsyncreturned an object with the primary host. So I made the connection go to the alternate host by disabling RDP on the primary host, then re-enabling it, then testing again and getting the unexpected result above.My guess is that the passage of time may have had some effect. But I am not sure because the connection to the primary host is established even without the passage of time by unchecking "Automatic address switching".
@VShawn commented on GitHub (Mar 6, 2025):
strange,
TestConnectionAsyncworks GOOD in my testing environment and returns true as expected.@itagagaki commented on GitHub (Mar 6, 2025):
I tried to provide a movie recording of the RDP connection procedure and step execution from the breakpoint, but after the RDP connection was disconnected, 1Remote froze (I used to call this a "crash") and could not reach the breakpoint. This happened twice in a row, so I have not yet successfully recorded it. I said randomly, but the frequency is quite high.
I would like to try until I can record it reaching a breakpoint and executing a step without freezing.
But maybe we should prioritize finding the cause of the freeze.
@VShawn commented on GitHub (Mar 6, 2025):
even stranger
during dozens of tests while debugging, I didn't encounter any
froze.However, this freeze might be related to the async calls. Since the initial design didn't include async calls, now forcibly changing it to async may have introduced some unknown issues.
@itagagaki commented on GitHub (Mar 9, 2025):
After applying the fix for #884, I have tried it a few times and it still does not freeze.
Is it possible that the modified part was related to the freeze?
The issue of not connecting to the primary host is still there and needs to be investigated.
@VShawn commented on GitHub (Mar 10, 2025):
i don't think so.
My tests are all connected to the main address, perhaps because my testing environment (virtual machine) is too ideal?
@rafi-d commented on GitHub (Mar 10, 2025):
If you can share your test exe (for x64) I can try to test-run it too. All my PCs are without passwords ATM though.
@itagagaki commented on GitHub (Mar 10, 2025):
Also reproduced with the latest nightly on my end.
1Remote-1.1.1-net6-x64-nightly-20250309-859e47.zip
Test steps and the results on my end:
Environment: 64-bit Windows 10 Pro 22H2 / Intel Core i7-11700K / 32GB RAM
mystery. I will keep a close eye on the freeze or not.
@rafi-d commented on GitHub (Mar 10, 2025):
My test results (two PCs with latest Windows 10 x64 enterprise, using the above nightly):
PC1: PC2 set as alternate
Firstly: the app is not crashing nor hanging-up.
Logic tests:
PC1 - disconnected from LAN , PC2 - is connected to LAN
PC1 - click connect from 1remote or click reconnect from PC1 RDP session - both connect to PC2 **OK
Title display - "PC1 name" **NOK (should display PC2 name per #868)
Connect PC1 to LAN again (while 1remote still in PC1-alternate RDP session to PC2)
PC1 - RDP session -> click reconnect, reconnects to PC2 again (the last active session) **NOK (should reconnect o PC1)
Auto-disconnect test
Disconnect PC1 again from LAN , and wait
RDP - triggers auto-re-connect and fails after 5 retries OK
After it fails (or cancel is clicked) - session is disconnected. **** ? Question: can you check again for both PC1 and PC2?
Comment - both RDP #number of retries and/or retry timeout - needs to be configurable in 1remote
Edit:
Looking @ help-about was the incorrect (old) version!
@VShawn commented on GitHub (Mar 10, 2025):
@rafi-d nope, there is the correct version: https://github.com/1Remote/1Remote/releases/tag/Nightly
@rafi-d commented on GitHub (Mar 10, 2025):
This was the release taken from the zip above ...
@itagagaki commented on GitHub (Mar 10, 2025):
I think the old build kept running in the system tray. In that case, the old one would stay even if you ran a different build of the exe. Please exit the old one completely.
@VShawn commented on GitHub (Mar 10, 2025):
@rafi-d
Attention to the compilation time 2025-03-09 means it is the latest. i forgot to edit the version number.
@rafi-d commented on GitHub (Mar 10, 2025):
Yes, the old one was running too, at the same time. I'll retest to make sure.
@rafi-d commented on GitHub (Mar 10, 2025):
The tests with the new (correct ) version) - shows correct re-connection in the previous test (always checking the primary first).
B. It also shows a blank tab if you click "cancel" during the RDP retries . Not a big deal, reconnect works after that.
@itagagaki commented on GitHub (Mar 13, 2025):
What happens on my end after the 5th try is that the window closes in many cases. This is probably not the expected behavior. It used to happen frequently that the whole application would freeze and I could not do anything, but this has not happened recently. In any case, the behavior seems to be unstable.
I have only seen this once. However, the reproducibility of this also seems to be random.
For the title, I think the expected behavior is to be "MainName (AltHostName)".
@rafi-d In your example if MainName is “RAFI LT4 (Wired + WiFi)” and the name of the connected alternate host is “RAFI-HTPC (tes... this is the expected behavior.
@rafi-d commented on GitHub (Mar 13, 2025):
Understood about the title. Yeah, there might be instability here
@itagagaki commented on GitHub (Mar 13, 2025):
Yeah, it would also be efficient to have that option when repeating this test many times.
@rafi-d commented on GitHub (Mar 14, 2025):
We need to find a way to show/indicate which one is currently on display. The same string X (Y) for both is not a good way to do it.
Either display only the active one, or swap it X (Y [alt.]) or Y [alt.] (X) where the first is the active display.
@VShawn commented on GitHub (Mar 15, 2025):
about name
As it mentioned by itagagaki, the "Name" in Common refers to the server name. The "name" in the credentials only represents the credential name.
Therefore, it will be displayed as:
Common Name(credential name)For example:
The server first connect via frp so it named as
Test(ViaFrp)Later, I closed the frp and connected to the wifi, to simulated a network switch. after reconnecting, because I switched to credential
LAN, title renamed toTest(LAN).rdp auto retries..
I am still investigating how to handle the automatic reconnec feature by RDP.
@itagagaki commented on GitHub (Mar 15, 2025):
this?
https://learn.microsoft.com/windows/win32/termserv/imsrdpclientadvancedsettings2
@rafi-d commented on GitHub (Mar 15, 2025):
Got it.
@VShawn commented on GitHub (Mar 15, 2025):
yeap, to disabled the auto reconn feature of RDP and enumerate when to display the reconnect button upon RDP disconnection and when it can be closed directly, as the code block mentioned in #878
github.com/1Remote/1Remote@aa84184cdd/Ui/View/Host/ProtocolHosts/AxMsRdpClient09Host.cs (L143-L184)@itagagaki commented on GitHub (Mar 26, 2025):
Oh, we can already specify maximum times that the RDP client control will retry to reconnect the session.
@VShawn commented on GitHub (Mar 26, 2025):
However, it only works in mstsc mode here, it is invalid under the tab window.
@itagagaki commented on GitHub (Mar 26, 2025):
Oh, no?
It also worked as expected in non-mstsc.exe mode (tab window mode).
@rafi-d commented on GitHub (Mar 29, 2025):
So, I've tried the latest nightly now. Name(s) display as designed. I've set retries to 1 . The test is simple:
Test steps are -
The RDP auto-connect starts, and fails.
Screenshots:
Some minor findings - some Chinese text in confguration:
Maybe widen the advanced list to show all params letters?
Possibly add a mouse hover display of the tab name(s) so to see longer strings
@itagagaki commented on GitHub (Apr 6, 2025):
I followed rafi-d's test. It reproduced as he said it would.
Precisely as I stated in https://github.com/1Remote/1Remote/issues/869#issuecomment-2721521928.
I believe this is due to issue #878.
So let's work on it.
@VShawn commented on GitHub (Apr 8, 2025):
After giving it some thought, perhaps disabling the auto reconnection feature of RDP could be an option. All reconnections would then be controlled by 1Remote. it might help bypass the "not responding" issue. Although this may increase the workload
BTW:
Some minor findingsMaybe widen the advanced list to show all params letters?Possibly add a mouse hover display of the tab name(s) so to see longer stringsWON'T FIX, That's what design is, the option only for Chinese USERS.some Chinese text in confguration@rafi-d commented on GitHub (Apr 8, 2025):
Sound like a good idea. I guess RDP also has some internal workload allocated to connection checks, so yours will just replace it...