mirror of
https://github.com/ethauvin/kobalt.git
synced 2025-04-26 00:17:11 -07:00
More robust server loop.
This commit is contained in:
parent
5958bf0c5d
commit
e252a5386c
1 changed files with 4 additions and 2 deletions
|
@ -69,8 +69,8 @@ public class KobaltServer @Inject constructor(val args: Args) : Runnable, IComma
|
|||
log(1, "Listening to port $portNumber")
|
||||
var quit = false
|
||||
val serverSocket = ServerSocket(portNumber)
|
||||
while (! quit) {
|
||||
val clientSocket = serverSocket.accept()
|
||||
val clientSocket = serverSocket.accept()
|
||||
while (!quit) {
|
||||
outgoing = PrintWriter(clientSocket.outputStream, true)
|
||||
if (pending.size > 0) {
|
||||
log(1, "Emptying the queue, size $pending.size()")
|
||||
|
@ -99,6 +99,8 @@ public class KobaltServer @Inject constructor(val args: Args) : Runnable, IComma
|
|||
}
|
||||
} catch(ex: SocketException) {
|
||||
log(1, "Client disconnected, resetting")
|
||||
} catch(ex: Exception) {
|
||||
log(1, "Command failed: ${ex.message}")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue