From 516327289f9361b2836dd98f189feac67a3831e5 Mon Sep 17 00:00:00 2001 From: Mike Hearn Date: Fri, 19 Jul 2013 12:05:00 +0200 Subject: [PATCH] Payment channels: Expose a client connection method that terminates the TCP connection but doesn't try to close the channel (ask the server to broadcast the contract). --- .../channels/PaymentChannelClientConnection.java | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/core/src/main/java/com/google/bitcoin/protocols/channels/PaymentChannelClientConnection.java b/core/src/main/java/com/google/bitcoin/protocols/channels/PaymentChannelClientConnection.java index fc865cda..795027c4 100644 --- a/core/src/main/java/com/google/bitcoin/protocols/channels/PaymentChannelClientConnection.java +++ b/core/src/main/java/com/google/bitcoin/protocols/channels/PaymentChannelClientConnection.java @@ -105,7 +105,7 @@ public class PaymentChannelClientConnection { }, Protos.TwoWayChannelMessage.getDefaultInstance(), Short.MAX_VALUE, timeoutSeconds*1000); // Initiate the outbound network connection. We don't need to keep this around. The wireParser object will handle - // things from here on our. + // things from here on out. new ProtobufClient(server, wireParser, timeoutSeconds * 1000); } @@ -163,4 +163,12 @@ public class PaymentChannelClientConnection { // Already closed...oh well } } + + /** + * Disconnects the network connection but doesn't request the server to close the channel first (literally just + * unplugs the network socket and marks the stored channel state as inactive). + */ + public void disconnectWithoutChannelClose() { + wireParser.closeConnection(); + } }