summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/main/kotlin/Connection.kt17
-rw-r--r--src/main/kotlin/ProtocolTranslator.kt5
2 files changed, 19 insertions, 3 deletions
diff --git a/src/main/kotlin/Connection.kt b/src/main/kotlin/Connection.kt
index a7de8cc..1cef2d3 100644
--- a/src/main/kotlin/Connection.kt
+++ b/src/main/kotlin/Connection.kt
@@ -110,8 +110,21 @@ class Connection(transLay: TransportLayer) : ProtocolTranslator {
TODO("Not yet implemented")
}
- override fun flush() {
- TODO("Not yet implemented")
+ override fun flush(oldtag: UShort): String? {
+ val omsg = OutMessage(NinePMessageType.TFLUSH, this.tagGen.generate(), listOf("oldtag"),
+ mapOf(
+ "oldtag" to BigInteger(oldtag.toString())
+ ),
+ emptyMap(),
+ emptyMap(),
+ this.maxSize
+ )
+ omsg.write(this.tl)
+ val checkErr = checkedInMessage(omsg.tag)
+ if (checkErr.first != null) {
+ return checkErr.first
+ }
+ return null
}
override fun attach(fid: UInt, afid: UInt, uname: String, aname: String): String? {
diff --git a/src/main/kotlin/ProtocolTranslator.kt b/src/main/kotlin/ProtocolTranslator.kt
index 4dad240..144eef6 100644
--- a/src/main/kotlin/ProtocolTranslator.kt
+++ b/src/main/kotlin/ProtocolTranslator.kt
@@ -38,8 +38,11 @@ interface ProtocolTranslator {
/**
* Abort a message.
+ *
+ * @param oldtag The tag of the message that needs to be purged.
+ * @return a possible error.
*/
- fun flush()
+ fun flush(oldtag: UShort): String?
/**
* Establish a connection.