Modern Apps git

← Modern-Apps.git

communicate: log IMS socket bind failures with cause

Commit
0572339c6ca322e49150f8bd660c1faa86267c80
Author
vayun-mathur <[email protected]>
When
2026-09-27 16:53 UTC (2 months ago)
Parents
2d36f5d

Diff

communicate/src/main/java/com/vayunmathur/communicate/data/rcs/RcsImsNetwork.kt
diff --git a/communicate/src/main/java/com/vayunmathur/communicate/data/rcs/RcsImsNetwork.kt b/communicate/src/main/java/com/vayunmathur/communicate/data/rcs/RcsImsNetwork.ktindex 6eb5d05fe5..18765511cc 100644--- a/communicate/src/main/java/com/vayunmathur/communicate/data/rcs/RcsImsNetwork.kt+++ b/communicate/src/main/java/com/vayunmathur/communicate/data/rcs/RcsImsNetwork.kt@@ -143,6 +143,7 @@ object RcsImsNetwork {             val bound = runCatching {                 val factory = ims.getSocketFactory()                 val local = lastLocalIp?.let { runCatching { InetAddress.getByName(it) }.getOrNull() }+                Log.i(TAG, "IMS socket to $host:$port via ${ims} local=$local")                 val socket = if (local != null) {                     factory.createSocket(host, port, local, 0)                 } else {@@ -152,9 +153,13 @@ object RcsImsNetwork {                 }                 socket.soTimeout = 0                 socket-            }.getOrNull()-            if (bound != null && bound.isConnected) return bound-            runCatching { bound?.close() }+            }+            val socket = bound.getOrElse {+                Log.w(TAG, "IMS socket bind failed to $host:$port", it)+                null+            }+            if (socket != null && socket.isConnected) return socket+            runCatching { socket?.close() }             // IMS network went stale — drop it so the next call re-requests.             cached = null             Log.w(TAG, "IMS socket bind failed; falling back to plain socket")