summaryrefslogtreecommitdiff
path: root/src/main/kotlin/Connection.kt
diff options
context:
space:
mode:
authorEdoardo La Greca2025-08-08 16:45:52 +0200
committerEdoardo La Greca2025-08-08 16:45:52 +0200
commitbedbcf252d63bcbfc3a4de24a5573667d86ca17d (patch)
tree4a83e634bb383bd57671743f9ae4ea601eb1ec98 /src/main/kotlin/Connection.kt
parent946e0e2d438f1076ea009901b1a69cb49425865f (diff)
change write to use exceptions instead of error strings
Diffstat (limited to 'src/main/kotlin/Connection.kt')
-rw-r--r--src/main/kotlin/Connection.kt10
1 files changed, 3 insertions, 7 deletions
diff --git a/src/main/kotlin/Connection.kt b/src/main/kotlin/Connection.kt
index 984b345..6630567 100644
--- a/src/main/kotlin/Connection.kt
+++ b/src/main/kotlin/Connection.kt
@@ -210,7 +210,7 @@ class Connection(transLay: TransportLayer) : ProtocolTranslator {
return imsg.fieldsRaw["data"]!!
}
- override fun write(fid: UInt, offset: ULong, count: UInt, data: Iterable<UByte>): Pair<String?, UInt> {
+ override fun write(fid: UInt, offset: ULong, count: UInt, data: Iterable<UByte>): UInt {
val data = data.take(count.toInt()).toTypedArray()
val omsg = OutMessage(NinePMessageType.TWRITE, this.tagGen.generate(), listOf("offset", "count", "data"),
mapOf(
@@ -224,15 +224,11 @@ class Connection(transLay: TransportLayer) : ProtocolTranslator {
this.maxSize
)
omsg.write(this.tl)
- val checkErr = checkedInMessage(omsg.tag)
- if (checkErr.first != null) {
- return Pair(checkErr.first, 0u)
- }
- val imsg = checkErr.second!!
+ val imsg = checkedInMessage(omsg.tag)
imsg.applyField(InMessage.Field("count", InMessage.Field.Type.INTEGER, 4u))
val count = imsg.fieldsInt["count"]!!
- return Pair(null, count.toInt().toUInt())
+ return count.toInt().toUInt()
}
override fun clunk(path: String) {