Repository navigation
Fix: Wire InterfaceMode into reticulum-kt interfaces - #1182
Cryptoteep wants to merge 3 commits into
Conversation
Fixes torlando-tech#1169 This wires the user-selected interface mode (string) to the reticulum-kt InterfaceMode enum by setting modeOverride on TCPClientInterface, TCPServerInterface, UDPInterface, AutoInterface, and RNodeInterface. INTERNAL mode is mapped to POINT_TO_POINT as a fallback pending reticulum-kt#91. A unit test verifies the mode propagation. Signed-off-by: Andreev Kirill Andreevich <andreev.gh2017@yandex.ru>
|
| ifacNetkey = config.passphrase, | ||
| ) | ||
| ).apply { | ||
| modeOverride = mapInterfaceMode(config.mode) |
There was a problem hiding this comment.
When a user changes the mode of an enabled interface, reloadInterfaces calls syncInterfaces, which keeps the running interface if its name is unchanged. The new modeOverride is set only when an interface is created. The user sees the change saved, but the interface keeps its old mode until it restarts. Recreate the interface when its mode changes.
Prompt To Fix With AI
This is a comment left during a code review.
Path: rns-backend-kt/src/main/kotlin/network/columba/app/rns/backend/kt/NativeInterfaceFactory.kt
Line: 391
Comment:
**Saved mode stays inactive**
When a user changes the mode of an enabled interface, `reloadInterfaces` calls `syncInterfaces`, which keeps the running interface if its name is unchanged. The new `modeOverride` is set only when an interface is created. The user sees the change saved, but the interface keeps its old mode until it restarts. Recreate the interface when its mode changes.
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.| targetHost = "127.0.0.1", | ||
| targetPort = 1234, | ||
| mode = modeString | ||
| ) | ||
|
|
||
| NativeInterfaceFactory.restartInterface(config) |
There was a problem hiding this comment.
The test starts a real TCPClient at 127.0.0.1:1234 without starting a server. If that port is unavailable and start() throws, the factory never tracks the interface. The test then fails before it can check the mode. Test the mapping without a live connection, or start a server in the test.
Prompt To Fix With AI
This is a comment left during a code review.
Path: rns-backend-kt/src/test/kotlin/network/columba/app/rns/backend/kt/NativeInterfaceFactoryModeTest.kt
Line: 30-35
Comment:
**Mode test needs a connection**
The test starts a real `TCPClient` at `127.0.0.1:1234` without starting a server. If that port is unavailable and `start()` throws, the factory never tracks the interface. The test then fails before it can check the mode. Test the mapping without a live connection, or start a server in the test.
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.| # resources declared in the library itself and none from the library's dependencies, | ||
| # thereby reducing the size of the R class for that library | ||
| android.nonTransitiveRClass=true | ||
| org.gradle.java.home=C:\\Program Files\\Eclipse Adoptium\\jdk-17.0.20.101-hotspot |
There was a problem hiding this comment.
gradle.properties now points Gradle to a Windows-only Java path. CI runs Gradle on Ubuntu, where that path does not exist, so builds and tests cannot start. Remove the machine-specific path and let each environment use its configured JDK.
Prompt To Fix With AI
This is a comment left during a code review.
Path: gradle.properties
Line: 1
Comment:
**Ubuntu builds cannot start**
`gradle.properties` now points Gradle to a Windows-only Java path. CI runs Gradle on Ubuntu, where that path does not exist, so builds and tests cannot start. Remove the machine-specific path and let each environment use its configured JDK.
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.
Fixes #1169
This wires the user-selected interface mode into the
reticulum-ktinterface objects for the Kotlin backend, addressing the issue where modes were silently dropped.What's done:
InterfaceModetonetwork.reticulum.common.InterfaceMode.INTERNALmode is temporarily mapped toPOINT_TO_POINTas a fallback with a warning log, pending the resolution of reticulum-kt issue Support for Encrypted Paper Messages (lxm:// URI Handler) #91.modeOverrideonTCPClientInterface,TCPServerInterface,UDPInterface,AutoInterfaceinNativeInterfaceFactory.kt.modeOverrideonRNodeInterfaceinRNodeConnectionHelper.ktfor SPP/USB/TCP.NativeInterfaceFactoryModeTest) that asserts the constructed interface object carries the expected mode.