Use new Quasar API to skip serialisation of TLS slots.

This commit is contained in:
Mike Hearn 2016-03-16 14:15:00 +01:00
parent 3c4ce0a8fe
commit 7ef8397920
3 changed files with 5 additions and 2 deletions
src/main/kotlin

@ -154,7 +154,7 @@ class StateMachineManager(val serviceHub: ServiceHub, val runInThread: Executor)
}
private fun deserializeFiber(bits: ByteArray): ProtocolStateMachine<*> {
val deserializer = Fiber.getFiberSerializer() as KryoSerializer
val deserializer = Fiber.getFiberSerializer(false) as KryoSerializer
val kryo = createKryo(deserializer.kryo)
val psm = kryo.readClassAndObject(Input(bits)) as ProtocolStateMachine<*>
return psm

@ -77,7 +77,7 @@ class ProtocolStateMachine<R>(val logic: ProtocolLogic<R>) : Fiber<R>("protocol"
private fun <T : Any> suspendAndExpectReceive(with: StateMachineManager.FiberRequest): UntrustworthyData<T> {
parkAndSerialize { fiber, serializer ->
// We don't use the passed-in serializer here, because we need to use our own augmented Kryo.
val deserializer = getFiberSerializer() as KryoSerializer
val deserializer = getFiberSerializer(false) as KryoSerializer
val kryo = createKryo(deserializer.kryo)
val stream = ByteArrayOutputStream()
Output(stream).use {

@ -26,6 +26,7 @@ import java.security.KeyPair
import java.security.PublicKey
import java.security.SignatureException
import java.time.Instant
import kotlin.system.exitProcess
/**
* This asset trading protocol implements a "delivery vs payment" type swap. It has two parties (B and S for buyer
@ -211,6 +212,8 @@ object TwoPartyTradeProtocol {
val (ptx, cashSigningPubKeys) = assembleSharedTX(tradeRequest)
val stx = signWithOurKeys(cashSigningPubKeys, ptx)
// exitProcess(0)
val signatures = swapSignaturesWithSeller(stx, tradeRequest.sessionID)
logger.trace { "Got signatures from seller, verifying ... " }