@@ -12,12 +12,12 @@ private[jsonrpclib] abstract class MessageDispatcher[F[_]](implicit F: Monadic[F
1212
1313 import F ._
1414
15- protected def background [A ](fa : F [A ]): F [Unit ]
15+ protected def background [A ](maybeCallId : Option [ CallId ], fa : F [A ]): F [Unit ]
1616 protected def reportError (params : Option [Payload ], error : ProtocolError , method : String ): F [Unit ]
1717 protected def getEndpoint (method : String ): F [Option [Endpoint [F ]]]
1818 protected def sendMessage (message : Message ): F [Unit ]
1919 protected def nextCallId (): F [CallId ]
20- protected def createPromise [A ](): F [(Try [A ] => F [Unit ], () => F [A ])]
20+ protected def createPromise [A ](callId : CallId ): F [(Try [A ] => F [Unit ], () => F [A ])]
2121 protected def storePendingCall (callId : CallId , handle : OutputMessage => F [Unit ]): F [Unit ]
2222 protected def removePendingCall (callId : CallId ): F [Option [OutputMessage => F [Unit ]]]
2323
@@ -34,7 +34,7 @@ private[jsonrpclib] abstract class MessageDispatcher[F[_]](implicit F: Monadic[F
3434 val encoded = inCodec.encode(input)
3535 doFlatMap(nextCallId()) { callId =>
3636 val message = InputMessage .RequestMessage (method, callId, Some (encoded))
37- doFlatMap(createPromise[Either [Err , Out ]]()) { case (fulfill, future) =>
37+ doFlatMap(createPromise[Either [Err , Out ]](callId )) { case (fulfill, future) =>
3838 val pc = createPendingCall(errCodec, outCodec, fulfill)
3939 doFlatMap(storePendingCall(callId, pc))(_ => doFlatMap(sendMessage(message))(_ => future()))
4040 }
@@ -45,7 +45,7 @@ private[jsonrpclib] abstract class MessageDispatcher[F[_]](implicit F: Monadic[F
4545 Codec .decode[Message ](Some (payload)).map {
4646 case im : InputMessage =>
4747 doFlatMap(getEndpoint(im.method)) {
48- case Some (ep) => background(executeInputMessage(im, ep))
48+ case Some (ep) => background(im.maybeCallId, executeInputMessage(im, ep))
4949 case None =>
5050 im.maybeCallId match {
5151 case None =>
0 commit comments