close socket if null received

This commit is contained in:
Adam 2022-07-06 16:21:07 +02:00
parent 412cf15097
commit d9e9e1af7d

View file

@ -64,8 +64,12 @@ class SyslogSocketServer(
channel.readUTF8Line()
}.fold(
onSuccess = { line ->
if (line != null) {
log("received '$line' from ${socket.description()}")
when (line) {
null -> {
log("received 'null' from ${socket.description()} - closing connection")
socket.close()
}
else -> log("received '$line' from ${socket.description()}")
}
line
},