[skip ci]fix typo
This commit is contained in:
@@ -2,8 +2,7 @@ package io.legado.app.web
|
|||||||
|
|
||||||
import fi.iki.elonen.NanoWSD
|
import fi.iki.elonen.NanoWSD
|
||||||
import io.legado.app.service.WebService
|
import io.legado.app.service.WebService
|
||||||
import io.legado.app.web.socket.BookSourceDebugWebSocket
|
import io.legado.app.web.socket.*
|
||||||
import io.legado.app.web.socket.RssSourceDebugWebSocket
|
|
||||||
|
|
||||||
class WebSocketServer(port: Int) : NanoWSD(port) {
|
class WebSocketServer(port: Int) : NanoWSD(port) {
|
||||||
|
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ class BookSearchWebSocket(handshakeRequest: NanoHTTPD.IHTTPSession) :
|
|||||||
private val normalClosure = NanoWSD.WebSocketFrame.CloseCode.NormalClosure
|
private val normalClosure = NanoWSD.WebSocketFrame.CloseCode.NormalClosure
|
||||||
private val searchModel = SearchModel(this, this)
|
private val searchModel = SearchModel(this, this)
|
||||||
|
|
||||||
private const val SEARCH_FINISH = "Search finish"
|
private val SEARCH_FINISH = "Search finish"
|
||||||
|
|
||||||
override fun onOpen() {
|
override fun onOpen() {
|
||||||
launch(IO) {
|
launch(IO) {
|
||||||
@@ -61,7 +61,7 @@ class BookSearchWebSocket(handshakeRequest: NanoHTTPD.IHTTPSession) :
|
|||||||
close(normalClosure, SEARCH_FINISH, false)
|
close(normalClosure, SEARCH_FINISH, false)
|
||||||
return@launch
|
return@launch
|
||||||
}
|
}
|
||||||
viewModel.search(System.currentTimeMillis(), key)
|
searchModel.search(System.currentTimeMillis(), key)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -87,6 +87,6 @@ class BookSearchWebSocket(handshakeRequest: NanoHTTPD.IHTTPSession) :
|
|||||||
|
|
||||||
override fun onSearchFinish(isEmpty: Boolean) = close(normalClosure, SEARCH_FINISH, false)
|
override fun onSearchFinish(isEmpty: Boolean) = close(normalClosure, SEARCH_FINISH, false)
|
||||||
|
|
||||||
override fun onSearchCancel(exception: Exception? = null) = close(normalClosure, exception?.toString() ?: SEARCH_FINISH, false)
|
override fun onSearchCancel(exception: Exception?) = close(normalClosure, exception?.toString() ?: SEARCH_FINISH, false)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user