diff options
Diffstat (limited to 'src/main')
-rw-r--r-- | src/main/kotlin/Connection.kt | 9 | ||||
-rw-r--r-- | src/main/kotlin/ProtocolTranslator.kt | 5 |
2 files changed, 5 insertions, 9 deletions
diff --git a/src/main/kotlin/Connection.kt b/src/main/kotlin/Connection.kt index 5fabf83..659dd41 100644 --- a/src/main/kotlin/Connection.kt +++ b/src/main/kotlin/Connection.kt @@ -120,7 +120,7 @@ class Connection(transLay: TransportLayer) : ProtocolTranslator { val imsg = checkedInMessage(omsg.tag) } - override fun attach(fid: UInt, afid: UInt, uname: String, aname: String): String? { + override fun attach(fid: UInt, afid: UInt, uname: String, aname: String) { val omsg = OutMessage(NinePMessageType.TATTACH, this.tagGen.generate(), listOf("fid", "afid", "uname", "aname"), mapOf( "fid" to BigInteger(fid.toString()), @@ -134,16 +134,11 @@ class Connection(transLay: TransportLayer) : ProtocolTranslator { this.maxSize ) omsg.write(this.tl) - val checkErr = checkedInMessage(omsg.tag) - if (checkErr.first != null) { - return checkErr.first - } - val imsg = checkErr.second!! + val imsg = checkedInMessage(omsg.tag) imsg.applyField(InMessage.Field("qid", InMessage.Field.Type.RAW, 13u)) val qid = QID(imsg.fieldsRaw["qid"]!!.toList()) this.pathInfo.addPath(PathInfo.Path(aname.split("/"), fid, qid)) - return null } override fun walk(fid: UInt, newfid: UInt, wname: List<String>): String? { diff --git a/src/main/kotlin/ProtocolTranslator.kt b/src/main/kotlin/ProtocolTranslator.kt index eb13fc2..1b45252 100644 --- a/src/main/kotlin/ProtocolTranslator.kt +++ b/src/main/kotlin/ProtocolTranslator.kt @@ -55,9 +55,10 @@ interface ProtocolTranslator { * @param afid A FID previously established by an auth message. * @param uname A user identifier. * @param aname The desired file tree to access. - * @return a possible error. + * @throws except.InvalidMessageException if the received message is invalid. + * @throws except.RErrorException if the received message is an R-error message. */ - fun attach(fid: UInt, afid: UInt, uname: String, aname: String): String? + fun attach(fid: UInt, afid: UInt, uname: String, aname: String) /** * Descend a directory hierarchy. |