Author: toad
Date: 2005-10-19 15:07:12 +0000 (Wed, 19 Oct 2005)
New Revision: 7439
Modified:
branches/publish-subscribe/freenet/src/freenet/node/SubscriptionHandler.java
Log:
Rename restarting -> subscribing. This is closer to what it actually means.
Modified:
branches/publish-subscribe/freenet/src/freenet/node/SubscriptionHandler.java
===================================================================
---
branches/publish-subscribe/freenet/src/freenet/node/SubscriptionHandler.java
2005-10-18 19:54:33 UTC (rev 7438)
+++
branches/publish-subscribe/freenet/src/freenet/node/SubscriptionHandler.java
2005-10-19 15:07:12 UTC (rev 7439)
@@ -45,10 +45,10 @@
private SubscribeSender sender;
/** Are we currently subscribed? */
private boolean subscribed;
- /** Are we currently restarting? */
- private boolean restarting;
+ /** Are we currently subscribing? */
+ private boolean subscribing;
/** Our restart UID */
- private long restartUID;
+ private long subscribingUID;
/** Is upstream restarting? */
private boolean upstreamRestarting;
/** Upstream's restart UID */
@@ -75,7 +75,7 @@
packets = new NumberedRecentItems(KEEP_PACKETS, true);
sender = null;
subscribed = false;
- restarting = false;
+ subscribing = false;
// Will be enabled when we actually start restarting
upstreamRestarting = false;
upstreamRestartUID = -1;
@@ -167,7 +167,7 @@
if(dropping) throw new DroppingSubscriptionHandlerException();
item = (PacketItem) packets.get(packetNumber);
isRoot = isRoot();
- isRestarting = restarting || upstreamRestarting;
+ isRestarting = subscribing || upstreamRestarting;
if(isRoot && item == null) {
myItem = new PacketItem(packetNumber, data);
packets.add(myItem);
@@ -259,7 +259,7 @@
}
private synchronized boolean isRoot() {
- return parent == null && !restarting;
+ return parent == null && !subscribing;
}
/**
@@ -292,7 +292,7 @@
while (true) {
synchronized (this) {
myParent = parent;
- if (restarting)
+ if (subscribing)
myParent = null;
if (upstreamRestarting)
myParent = null;
@@ -486,8 +486,8 @@
/**
* Handle a SubscribeRequest. Do not route it. Add the node to the list
- * of subscriber nodes and send it our status. Caller should have
- * checked ID for loops.
+ * of subscriber nodes and send it our status. If necessary, start a
+ * SubscribeSender to route it. Caller should have checked ID for loops.
*
* @param m
* The message to reply to.
@@ -538,8 +538,8 @@
}
}
- if((!subscribed) && (!restarting)) {
- restarting = true;
+ if((!subscribed) && (!subscribing)) {
+ subscribing = true;
nowRestarting = true;
}
}
@@ -549,7 +549,7 @@
}
} finally {
if(nowRestarting && sender == null) {
- restarting = false;
+ subscribing = false;
}
}
@@ -703,26 +703,26 @@
try {
synchronized(this) {
if(dropping) throw new DroppingSubscriptionHandlerException();
- if(restarting) {
+ if(subscribing) {
return;
} else {
restartingNow = true;
- restartUID = random.nextLong();
- restarting = true;
+ subscribingUID = random.nextLong();
+ subscribing = true;
}
}
startSubscribe(random.nextLong(), Node.MAX_HTL,
node.lm.getLocation().getValue(), null, null);
} finally {
if(restartingNow && sender == null)
- restarting = false;
+ subscribing = false;
}
}
- synchronized long getRestartUID() {
+ synchronized long getSubscribingUID() {
if(upstreamRestarting)
return upstreamRestartUID;
else
- return restartUID;
+ return subscribingUID;
}
public synchronized double targetLocation() {
@@ -773,7 +773,7 @@
parent = next;
subscribed = true;
// Do not null sender, as still using it; it persists
for as long as the subscription does
- restarting = false;
+ subscribing = false;
rootLocation = rootLoc;
handlers = subscriberPeerHandlers;
if(handlers != null) {
@@ -877,7 +877,7 @@
} else {
sender = null;
subscribed = false;
- restarting = false;
+ subscribing = false;
dropping = true;
}
}
@@ -964,7 +964,7 @@
SubscribeHandler[] handlers;
ClientSubscriptionHandler[] clients;
synchronized(this) {
- restarting = true;
+ subscribing = true;
subscribed = false;
rootLocation = -1.0;
parent = null;
@@ -976,4 +976,8 @@
for(int i=0;i<clients.length;i++)
clients[i].notifyDisconnected();
}
+
+ public long getUpstreamRestartUID() {
+ return upstreamRestartUID;
+ }
}
_______________________________________________
cvs mailing list
[email protected]
http://emu.freenetproject.org/cgi-bin/mailman/listinfo/cvs