diff options
author | Li Haoyi <haoyi.sg@gmail.com> | 2019-10-13 18:06:51 +0800 |
---|---|---|
committer | Li Haoyi <haoyi.sg@gmail.com> | 2019-10-13 18:06:51 +0800 |
commit | 39d51e36cd5f2058966dd6200609d8fb9dac92ec (patch) | |
tree | 2a587f99d3e4cef63929408a2505ab9cfcb84d47 /cask | |
parent | a430a35b8efddbb4c8c694953e9b1fa8e19bb71a (diff) | |
download | cask-39d51e36cd5f2058966dd6200609d8fb9dac92ec.tar.gz cask-39d51e36cd5f2058966dd6200609d8fb9dac92ec.tar.bz2 cask-39d51e36cd5f2058966dd6200609d8fb9dac92ec.zip |
avoid redundantly completing promise in WsClient connection failure
Diffstat (limited to 'cask')
-rw-r--r-- | cask/util/src/cask/util/WsClient.scala | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/cask/util/src/cask/util/WsClient.scala b/cask/util/src/cask/util/WsClient.scala index f15d7df..152ab3b 100644 --- a/cask/util/src/cask/util/WsClient.scala +++ b/cask/util/src/cask/util/WsClient.scala @@ -4,7 +4,6 @@ import scala.concurrent.duration.Duration import scala.concurrent.{Await, ExecutionContext, Promise} class WsClient(impl: WebsocketBase) - (f: PartialFunction[cask.util.Ws.Event, Unit]) (implicit ec: ExecutionContext, log: Logger) extends cask.util.BatchActor[Ws.Event]{ @@ -33,7 +32,7 @@ object WsClient{ val p = Promise[WsClient] val impl = new WebsocketClientImpl(url) { def onOpen() = { - if (!p.isCompleted) p.success(new WsClient(this)(f)) + if (!p.isCompleted) p.success(new WsClient(this)) } def onMessage(message: String) = { receiveActor.send(Ws.Text(message)) @@ -43,7 +42,6 @@ object WsClient{ } def onClose(code: Int, reason: String) = { receiveActor.send(Ws.Close(code, reason)) - if (!p.isCompleted) p.success(new WsClient(this)(f)) } def onError(ex: Exception): Unit = { receiveActor.send(Ws.Error(ex)) |