@@ -21,9 +21,6 @@ import kotlinx.coroutines.withContext
21
21
* /proc/net/ipv{,6} at a regular interval.
22
22
*
23
23
* If a process stops listening the port forward is removed.
24
- *
25
- * If the user manually removes a port, it will be added back at the next
26
- * interval.
27
24
*/
28
25
@Suppress(" UnstableApiUsage" )
29
26
class CoderPortForwardService (
@@ -34,6 +31,8 @@ class CoderPortForwardService(
34
31
35
32
// TODO: Make customizable.
36
33
// TODO: I also see 63342, 57675, and 56830 for JetBrains. Are they static?
34
+ // TODO: If you have multiple IDEs, you will see 5991. 5992, etc. Can we
35
+ // detect all of these and exclude them?
37
36
private val ignoreList = setOf (
38
37
22 , // SSH
39
38
5990 , // JetBrains Gateway port.
@@ -68,13 +67,13 @@ class CoderPortForwardService(
68
67
// Remove ports that are no longer listening.
69
68
val removed = ports.filterNot { it.hostPortNumber in listeningPorts }
70
69
if (removed.isNotEmpty()) {
71
- logger.info(" removing ports: $removed " )
70
+ logger.info(" removing ports: ${ removed.map { it.hostPortNumber }} " )
72
71
}
73
72
removed.forEach {
74
73
try {
75
74
manager.removePort(it)
76
75
} catch (ex: Exception ) {
77
- logger.error(" failed to remove port $it " , ex)
76
+ logger.error(" failed to remove port ${it.hostPortNumber} " , ex)
78
77
}
79
78
}
80
79
0 commit comments