Skip to content

Commit 8c5e15f

Browse files
Fix clock resync issue (session-foundation#1998)
1 parent bca6f20 commit 8c5e15f

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

app/src/main/java/org/session/libsession/network/SnodeClock.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ class SnodeClock @Inject constructor(
126126
val requestStarted = SystemClock.elapsedRealtime()
127127
var networkTime = snodeApiExecutor.get().execute(
128128
SnodeApiRequest(
129-
snode = snodeDirectory.getRandomSnode(),
129+
snode = node,
130130
api = getInfoApi.get(),
131131
)
132132
).timestamp.toEpochMilli()
@@ -172,15 +172,15 @@ class SnodeClock @Inject constructor(
172172
}
173173

174174
private suspend fun pickDistinctRandomSnodes(count: Int): List<org.session.libsignal.utilities.Snode> {
175-
val out = LinkedHashSet<org.session.libsignal.utilities.Snode>(count)
175+
val out = ArrayList<org.session.libsignal.utilities.Snode>(count)
176176
var guard = 0
177177
// Added a sanity check for pool size to prevent infinite loops if pool is tiny
178178
val poolSize = snodeDirectory.getSnodePool().size
179179

180180
while (out.size < count && out.size < poolSize && guard++ < 20) {
181181
out += snodeDirectory.getRandomSnode()
182182
}
183-
return out.toList()
183+
return out
184184
}
185185

186186
/**

0 commit comments

Comments
 (0)