0.7.0-SNAPSHOT: migration to kotlin 2.2.21, upgrade dependencies, IOS/MacOS compatibility for broken kotlin.time/kotlinx.datetime
This commit is contained in:
1 parent
bc46e11158
commit
7cec803174
11 files changed
+37
-28
No files matched your search
@@ -15,12 +15,11 @@ import kotlinx.serialization.Serializable
|
||||
import net.sergeych.bintools.toDataSource
|
||||
import net.sergeych.bipack.BipackDecoder
|
||||
import net.sergeych.bipack.BipackEncoder
|
||||
import net.sergeych.kiloparsec.Command.Call
|
||||
import net.sergeych.kiloparsec.Command.Companion.unpackCall
|
||||
import net.sergeych.utools.unpack
|
||||
|
||||
/**
|
||||
* Typesafe command definition. Command is a universal entity in Divan: it is used
|
||||
* Typesafe command definition. Command is a universal entity in kiloparsec (and also diwan): it is used
|
||||
* in node-2-node protocols and client API, and most importantly in calling smart contract
|
||||
* methods. This is essentially a Kotlin binding to typesafe serialize command calls and
|
||||
* deserialize results.
|
||||
|
||||
@@ -27,13 +27,12 @@ import kotlinx.serialization.encoding.Encoder
|
||||
import kotlinx.serialization.serializer
|
||||
import net.sergeych.bipack.Unsigned
|
||||
import net.sergeych.crypto2.toDump
|
||||
import net.sergeych.kiloparsec.Transport.Device
|
||||
import net.sergeych.mp_logger.*
|
||||
import net.sergeych.utools.pack
|
||||
import net.sergeych.utools.unpack
|
||||
|
||||
/**
|
||||
* Divan channel that operates some block [Device] exporting a given [localInterface]
|
||||
* Kiloparsec channel that operates some block [Device] exporting a given [localInterface]
|
||||
* to remote callers. [LocalInterface] allows session managing, transmitting exceptions
|
||||
* in a scure and multiplatform way and provide local command execution (typed RPC)
|
||||
*/
|
||||
@@ -251,7 +250,7 @@ class Transport<S>(
|
||||
} catch (cce: LocalInterface.BreakConnectionException) {
|
||||
info { "closing connection by local request ($cce)" }
|
||||
device.close()
|
||||
} catch (t: RemoteInterface.ClosedException) {
|
||||
} catch (_: RemoteInterface.ClosedException) {
|
||||
// it is ok: we just exit the coroutine normally
|
||||
// and mark we're closing
|
||||
isClosed = true
|
||||
|
||||
@@ -9,7 +9,6 @@
|
||||
*/
|
||||
|
||||
import kotlinx.coroutines.test.runTest
|
||||
import kotlinx.datetime.Instant
|
||||
import net.sergeych.bipack.BipackEncoder
|
||||
import net.sergeych.crypto2.initCrypto
|
||||
import net.sergeych.kiloparsec.KiloParams
|
||||
@@ -21,6 +20,7 @@ import kotlin.test.Test
|
||||
import kotlin.test.assertContentEquals
|
||||
import kotlin.test.assertEquals
|
||||
import kotlin.time.Duration.Companion.microseconds
|
||||
import kotlin.time.Instant
|
||||
|
||||
class PackTest {
|
||||
inline fun <reified T>check(x: T?) {
|
||||
|
||||
@@ -76,7 +76,8 @@ class TransportTest {
|
||||
"p2: $it"
|
||||
}
|
||||
on(cmdSlow) {
|
||||
delay(100)
|
||||
// the problem: runTest() breaks delays so it is not enough
|
||||
for( i in 0..10000) delay(1)
|
||||
"done"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,11 +22,11 @@ import kotlinx.coroutines.flow.Flow
|
||||
import kotlinx.coroutines.flow.flow
|
||||
import kotlinx.coroutines.sync.Mutex
|
||||
import kotlinx.coroutines.sync.withLock
|
||||
import kotlinx.datetime.Clock
|
||||
import net.sergeych.kiloparsec.*
|
||||
import net.sergeych.mp_logger.*
|
||||
import net.sergeych.mp_tools.globalLaunch
|
||||
import net.sergeych.tools.AtomicCounter
|
||||
import kotlin.time.Clock
|
||||
import kotlin.time.Duration.Companion.seconds
|
||||
|
||||
private val logCounter = AtomicCounter(0)
|
||||
@@ -140,7 +140,7 @@ private fun inetTransportDevice(
|
||||
sockInput.readFully(data, 0, size)
|
||||
inputBlocks.send(data.toUByteArray())
|
||||
}
|
||||
} catch (e: ClosedReceiveChannelException) {
|
||||
} catch (_: ClosedReceiveChannelException) {
|
||||
log.error { "closed receive channel " }
|
||||
stop()
|
||||
break
|
||||
|
||||
@@ -19,13 +19,13 @@ import kotlinx.coroutines.channels.ClosedSendChannelException
|
||||
import kotlinx.coroutines.coroutineScope
|
||||
import kotlinx.coroutines.delay
|
||||
import kotlinx.coroutines.launch
|
||||
import kotlinx.datetime.Clock
|
||||
import net.sergeych.kiloparsec.SyncValue
|
||||
import net.sergeych.mp_logger.Log
|
||||
import net.sergeych.mp_logger.Loggable
|
||||
import net.sergeych.mp_logger.debug
|
||||
import net.sergeych.mp_logger.exception
|
||||
import net.sergeych.mp_tools.globalLaunch
|
||||
import kotlin.time.Clock
|
||||
import kotlin.time.Duration
|
||||
|
||||
/**
|
||||
@@ -171,10 +171,10 @@ internal class UdpSocketTransport(
|
||||
while (!isClosed) {
|
||||
try {
|
||||
server.sendBlock(UdpBlock.Data(outputDataBlocks.receive()), socketAddress)
|
||||
} catch (e: CancellationException) {
|
||||
} catch (_: CancellationException) {
|
||||
// this is ok
|
||||
break
|
||||
} catch (e: ClosedReceiveChannelException) {
|
||||
} catch (_: ClosedReceiveChannelException) {
|
||||
debug { "input channel is closed, closing" }
|
||||
close()
|
||||
break
|
||||
|
||||
Reference in new issue
Block a user