From abe9513ddeb03e071cfc9b91ca40a18b6c02078a Mon Sep 17 00:00:00 2001 From: Matt Corallo Date: Thu, 21 Nov 2013 09:45:51 -0500 Subject: [PATCH] Don't allow setting writeTarget twice. --- .../main/java/com/google/bitcoin/core/PeerSocketHandler.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/core/src/main/java/com/google/bitcoin/core/PeerSocketHandler.java b/core/src/main/java/com/google/bitcoin/core/PeerSocketHandler.java index afb6ae9e..5eb6a146 100644 --- a/core/src/main/java/com/google/bitcoin/core/PeerSocketHandler.java +++ b/core/src/main/java/com/google/bitcoin/core/PeerSocketHandler.java @@ -189,9 +189,11 @@ public abstract class PeerSocketHandler extends AbstractTimeoutHandler implement */ @Override public void setWriteTarget(MessageWriteTarget writeTarget) { + checkArgument(writeTarget != null); lock.lock(); boolean closeNow = false; try { + checkArgument(this.writeTarget == null); closeNow = closePending; this.writeTarget = writeTarget; } finally {