mirror of
https://gitlab.futo.org/videostreaming/grayjay.git
synced 2025-09-17 15:02:34 +00:00
Crashfix in nsdmanager. StateSync reconnects less often. Channels are closed when sending fails in sync.
This commit is contained in:
parent
89526efe7a
commit
9f78e9b7dd
3 changed files with 12 additions and 3 deletions
|
@ -176,7 +176,11 @@ class StateCasting {
|
|||
fun stopDiscovering() {
|
||||
_nsdManager?.apply {
|
||||
_discoveryListeners.forEach {
|
||||
stopServiceDiscovery(it.value)
|
||||
try {
|
||||
stopServiceDiscovery(it.value)
|
||||
} catch (e: Throwable) {
|
||||
//Ignored
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -460,10 +460,10 @@ class StateSync {
|
|||
Log.i(TAG, "Started relay session.")
|
||||
} catch (e: Throwable) {
|
||||
Log.e(TAG, "Relay session failed.", e)
|
||||
Thread.sleep(5000)
|
||||
} finally {
|
||||
_relaySession?.stop()
|
||||
_relaySession = null
|
||||
Thread.sleep(5000)
|
||||
}
|
||||
}
|
||||
}.apply { start() }
|
||||
|
@ -737,6 +737,9 @@ class StateSync {
|
|||
val json = String(dataBody, Charsets.UTF_8);
|
||||
val history = Serializer.json.decodeFromString<List<HistoryVideo>>(json);
|
||||
Logger.i(TAG, "SyncHistory received ${history.size} videos from ${remotePublicKey}");
|
||||
if (history.size == 1) {
|
||||
Logger.i(TAG, "SyncHistory received update video '${history[0].video.name}' (url: ${history[0].video.url}) at timestamp ${history[0].position}");
|
||||
}
|
||||
|
||||
var lastHistory = OffsetDateTime.MIN;
|
||||
for(video in history){
|
||||
|
|
|
@ -218,7 +218,9 @@ class SyncSession : IAuthorizable {
|
|||
sent = true
|
||||
break
|
||||
} catch (e: Throwable) {
|
||||
Logger.w(TAG, "Packet failed to send (opcode = $opcode, subOpcode = $subOpcode)", e)
|
||||
Logger.w(TAG, "Packet failed to send (opcode = $opcode, subOpcode = $subOpcode), closing channel", e)
|
||||
channel.close()
|
||||
removeChannel(channel)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue