@@ -21,9 +21,6 @@ import kotlinx.coroutines.withContext
2121 * /proc/net/ipv{,6} at a regular interval.
2222 *
2323 * 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.
2724 */
2825@Suppress(" UnstableApiUsage" )
2926class CoderPortForwardService (
@@ -34,6 +31,8 @@ class CoderPortForwardService(
3431
3532 // TODO: Make customizable.
3633 // 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?
3736 private val ignoreList = setOf (
3837 22 , // SSH
3938 5990 , // JetBrains Gateway port.
@@ -68,13 +67,13 @@ class CoderPortForwardService(
6867 // Remove ports that are no longer listening.
6968 val removed = ports.filterNot { it.hostPortNumber in listeningPorts }
7069 if (removed.isNotEmpty()) {
71- logger.info(" removing ports: $removed " )
70+ logger.info(" removing ports: ${ removed.map { it.hostPortNumber }} " )
7271 }
7372 removed.forEach {
7473 try {
7574 manager.removePort(it)
7675 } catch (ex: Exception ) {
77- logger.error(" failed to remove port $it " , ex)
76+ logger.error(" failed to remove port ${it.hostPortNumber} " , ex)
7877 }
7978 }
8079
0 commit comments