diff --git a/.idea/artifacts/KMQTT_jvm_0_0_8.xml b/.idea/artifacts/KMQTT_jvm_0_0_8.xml
new file mode 100644
index 0000000..96cb8ba
--- /dev/null
+++ b/.idea/artifacts/KMQTT_jvm_0_0_8.xml
@@ -0,0 +1,8 @@
+
+
+ C:\Users\39340\IdeaProjects\KMQTT\build\libs
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/artifacts/KMQTT_jvm_0_0_9.xml b/.idea/artifacts/KMQTT_jvm_0_0_9.xml
new file mode 100644
index 0000000..ee327ab
--- /dev/null
+++ b/.idea/artifacts/KMQTT_jvm_0_0_9.xml
@@ -0,0 +1,8 @@
+
+
+ C:\Users\39340\IdeaProjects\KMQTT\build\libs
+
+
+
+
+
\ No newline at end of file
diff --git a/Readme.md b/Readme.md
index aed709a..47239dd 100644
--- a/Readme.md
+++ b/Readme.md
@@ -37,7 +37,7 @@ repositories {
maven { url "https://jitpack.io" }
}
dependencies {
- implementation 'com.github.davidepianca98:KMQTT:0.0.8'
+ implementation 'com.github.davidepianca98:KMQTT:0.0.9'
}
```
@@ -55,7 +55,7 @@ kotlin {
sourceSets {
commonMain {
dependencies {
- implementation 'com.github.davidepianca98:KMQTT:0.0.8'
+ implementation 'com.github.davidepianca98:KMQTT:0.0.9'
}
}
}
diff --git a/build.gradle.kts b/build.gradle.kts
index 14cf732..fc2efc3 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -7,7 +7,7 @@ plugins {
}
group = "com.github.davidepianca98"
-version = "0.0.8"
+version = "0.0.9"
repositories {
mavenCentral()
@@ -116,3 +116,16 @@ tasks {
dependsOn("shadowJar")
}
}
+
+publishing {
+ repositories {
+ maven {
+ name = "GitHubPackages"
+ url = uri("https://maven.pkg.github.com/davidepianca98/KMQTT")
+ credentials {
+ username = project.findProperty("gpr.user") as String? ?: System.getenv("GITHUB_USERNAME")
+ password = project.findProperty("gpr.key") as String? ?: System.getenv("GITHUB_PACKAGES")
+ }
+ }
+ }
+}
diff --git a/src/commonMain/kotlin/mqtt/broker/ClientConnection.kt b/src/commonMain/kotlin/mqtt/broker/ClientConnection.kt
index 277e0fb..68c9914 100644
--- a/src/commonMain/kotlin/mqtt/broker/ClientConnection.kt
+++ b/src/commonMain/kotlin/mqtt/broker/ClientConnection.kt
@@ -101,6 +101,7 @@ class ClientConnection(
}
private fun close() {
+ client.close()
broker.sessions[clientId]?.disconnected()
}
diff --git a/src/commonMain/kotlin/socket/Socket.kt b/src/commonMain/kotlin/socket/Socket.kt
index 8576bf5..36409f0 100644
--- a/src/commonMain/kotlin/socket/Socket.kt
+++ b/src/commonMain/kotlin/socket/Socket.kt
@@ -7,6 +7,8 @@ expect open class Socket : SocketInterface {
override fun sendRemaining()
override fun read(): UByteArray?
+
+ override fun close()
}
open class IOException(message: String? = null) : Exception(message)
diff --git a/src/commonMain/kotlin/socket/SocketInterface.kt b/src/commonMain/kotlin/socket/SocketInterface.kt
index 11f2aa8..962f6e9 100644
--- a/src/commonMain/kotlin/socket/SocketInterface.kt
+++ b/src/commonMain/kotlin/socket/SocketInterface.kt
@@ -7,4 +7,6 @@ interface SocketInterface {
fun sendRemaining()
fun read(): UByteArray?
+
+ fun close()
}
diff --git a/src/jvmMain/kotlin/socket/Socket.kt b/src/jvmMain/kotlin/socket/Socket.kt
index 1326315..4137e7c 100644
--- a/src/jvmMain/kotlin/socket/Socket.kt
+++ b/src/jvmMain/kotlin/socket/Socket.kt
@@ -83,7 +83,7 @@ actual open class Socket(private val sendBuffer: ByteBuffer, private val receive
else null
}
- fun close() {
+ actual override fun close() {
val channel = key?.channel() as SocketChannel
key?.cancel()
channel.close()
diff --git a/src/linuxArm32HfpMain/kotlin/socket/Socket.kt b/src/linuxArm32HfpMain/kotlin/socket/Socket.kt
index 7d8337a..c23be04 100644
--- a/src/linuxArm32HfpMain/kotlin/socket/Socket.kt
+++ b/src/linuxArm32HfpMain/kotlin/socket/Socket.kt
@@ -65,7 +65,7 @@ actual open class Socket(
}
}
- open fun close() {
+ actual override fun close() {
shutdown(socket, SHUT_WR)
close(socket)
}
diff --git a/src/linuxX64Main/kotlin/socket/Socket.kt b/src/linuxX64Main/kotlin/socket/Socket.kt
index 9f3ed2c..9abe2af 100644
--- a/src/linuxX64Main/kotlin/socket/Socket.kt
+++ b/src/linuxX64Main/kotlin/socket/Socket.kt
@@ -65,7 +65,7 @@ actual open class Socket(
}
}
- open fun close() {
+ actual override fun close() {
shutdown(socket, SHUT_WR)
close(socket)
}
diff --git a/src/mingwMain/kotlin/socket/Socket.kt b/src/mingwMain/kotlin/socket/Socket.kt
index c355254..253da6d 100644
--- a/src/mingwMain/kotlin/socket/Socket.kt
+++ b/src/mingwMain/kotlin/socket/Socket.kt
@@ -67,7 +67,7 @@ actual open class Socket(
}
}
- open fun close() {
+ actual override fun close() {
shutdown(socket, SD_SEND)
closesocket(socket)
}