diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/main/kotlin/Connection.kt | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/src/main/kotlin/Connection.kt b/src/main/kotlin/Connection.kt index e0b7f18..6247620 100644 --- a/src/main/kotlin/Connection.kt +++ b/src/main/kotlin/Connection.kt @@ -80,6 +80,7 @@ class Connection(transLay: TransportLayer) : ProtocolTranslator { mapOf( "version" to version ), + emptyMap(), this.maxSize ) val imsg: InMessage @@ -136,18 +137,14 @@ class Connection(transLay: TransportLayer) : ProtocolTranslator { "count" to BigInteger(count.toString()) ), emptyMap(), + emptyMap(), this.maxSize ) - val imsg: InMessage - try { - imsg = InMessage(this.tl, this.maxSize, omsg.tag) - } catch (ime: InvalidMessageException) { - return Pair(ime.message, emptyArray()) - } - if (imsg.type == NinePMessageType.RERROR) { - imsg.applyField(InMessage.Field("ename", InMessage.Field.Type.STRING, 0u)) - return Pair(imsg.fieldsStr["ename"], emptyArray()) + val checkErr = checkedInMessage(omsg.tag) + if (checkErr.first != null) { + return Pair(checkErr.first, emptyArray()) } + val imsg = checkErr.second!! imsg.applyField(InMessage.Field("count", InMessage.Field.Type.INTEGER, 4u)) val count = imsg.fieldsInt["count"]!!.toInt().toUInt() imsg.applyField(InMessage.Field("data", InMessage.Field.Type.RAW, count)) |