From 829139b1e781b3b9e352b990c48e9a58e1291db1 Mon Sep 17 00:00:00 2001 From: "Ray J. Greenwell" Date: Wed, 1 Aug 2012 18:44:49 -0700 Subject: [PATCH] Don't save the NodeRecord if our nodeName is null. This is to support running in ad-hoc, single-node noded mode. However, it appears some code in here will choke on a null node name. This is for something in Spiral Knights, where we used to run in non-noded or noded mode, and so we already cope with the nodeName being null. Now we want to always run noded, so that we can DRY and not check various local variables before checking the (other) NodeObjects: now we can just check against all the node objects. So I may need to return here and make safe various equality checks against the nodeName. --- .../presents/peer/server/PeerManager.java | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/core/src/main/java/com/threerings/presents/peer/server/PeerManager.java b/core/src/main/java/com/threerings/presents/peer/server/PeerManager.java index 0f11c6086..09ba74eb4 100644 --- a/core/src/main/java/com/threerings/presents/peer/server/PeerManager.java +++ b/core/src/main/java/com/threerings/presents/peer/server/PeerManager.java @@ -343,12 +343,14 @@ public abstract class PeerManager _self = new NodeRecord( _nodeName, hostName, (publicHostName == null) ? hostName : publicHostName, region, port); - _invoker.postUnit(new WriteOnlyUnit("registerNode(" + _self + ")") { - @Override - public void invokePersist () throws Exception { - _noderepo.updateNode(_self); - } - }); + if (_nodeName != null) { + _invoker.postUnit(new WriteOnlyUnit("registerNode(" + _self + ")") { + @Override + public void invokePersist () throws Exception { + _noderepo.updateNode(_self); + } + }); + } // set the invocation service _nodeobj.setPeerService(_invmgr.registerProvider(this, PeerMarshaller.class));