com.google.bitcoin.protocols.channels
Interface PaymentChannelServer.ServerConnection

Enclosing class:
PaymentChannelServer

public static interface PaymentChannelServer.ServerConnection

Implements the connection between this server and the client, providing an interface which allows messages to be sent to the client, requests for the connection to the client to be closed, and callbacks which occur when the channel is fully open or the client completes a payment.


Method Summary
 void channelOpen(Sha256Hash contractHash)
          Triggered when the channel is opened and payments can begin
 void destroyConnection(PaymentChannelCloseException.CloseReason reason)
          Requests that the connection to the client be closed
 void paymentIncrease(BigInteger by, BigInteger to)
          Called when the payment in this channel was successfully incremented by the client
 void sendToClient(Protos.TwoWayChannelMessage msg)
          Requests that the given message be sent to the client.
 

Method Detail

sendToClient

void sendToClient(Protos.TwoWayChannelMessage msg)

Requests that the given message be sent to the client. There are no blocking requirements for this method, however the order of messages must be preserved.

If the send fails, no exception should be thrown, however PaymentChannelServer.connectionClosed() should be called immediately.

Called while holding a lock on the PaymentChannelServer object - be careful about reentrancy


destroyConnection

void destroyConnection(PaymentChannelCloseException.CloseReason reason)

Requests that the connection to the client be closed

Called while holding a lock on the PaymentChannelServer object - be careful about reentrancy

Parameters:
reason - The reason for the closure, see the individual values for more details. It is usually safe to ignore this value.

channelOpen

void channelOpen(Sha256Hash contractHash)

Triggered when the channel is opened and payments can begin

Called while holding a lock on the PaymentChannelServer object - be careful about reentrancy

Parameters:
contractHash - A unique identifier which represents this channel (actually the hash of the multisig contract)

paymentIncrease

void paymentIncrease(BigInteger by,
                     BigInteger to)

Called when the payment in this channel was successfully incremented by the client

Called while holding a lock on the PaymentChannelServer object - be careful about reentrancy

Parameters:
by - The increase in total payment
to - The new total payment to us (not including fees which may be required to claim the payment)


Copyright © 2014. All rights reserved.