Date: Wednesday, September 6, 2006 @ 16:44:29
Author: nunomrc
Path: /cvsroot/hedera/hedera/src/org/continuent/hedera/appia
Modified: HederaSupportSession.java (1.10 -> 1.11)
Fixed HEDERA-17.
---------------------------+
HederaSupportSession.java | 43 ++++++++++++++++++++++++++++++++++---------
1 files changed, 34 insertions(+), 9 deletions(-)
Index: hedera/src/org/continuent/hedera/appia/HederaSupportSession.java
diff -u hedera/src/org/continuent/hedera/appia/HederaSupportSession.java:1.10
hedera/src/org/continuent/hedera/appia/HederaSupportSession.java:1.11
--- hedera/src/org/continuent/hedera/appia/HederaSupportSession.java:1.10
Wed Sep 6 12:40:34 2006
+++ hedera/src/org/continuent/hedera/appia/HederaSupportSession.java Wed Sep
6 16:44:29 2006
@@ -79,7 +79,7 @@
private InetSocketAddress myAddress = null;
private Group myGroup = null;
private boolean requestedConnect = false,
- socketAvailable = false;
+ socketAvailable = false, requestedDisconnect = false;
private ViewState vs = null;
private LocalState ls = null;
private Channel channel = null;
@@ -289,13 +289,22 @@
*/
private void handleHederaDisconnect()
{
- try
+ if(isBlocked)
{
- (new LeaveEvent(channel, Direction.DOWN, this, myGroup, vs.id)).go();
+ // disconnect was requested, but the view is changing.
+ // silent disconnection will only be done when the new view is delivered.
+ requestedDisconnect = true;
}
- catch (AppiaEventException e)
+ else
{
- e.printStackTrace();
+ try
+ {
+ (new LeaveEvent(channel, Direction.DOWN, this, myGroup, vs.id)).go();
+ }
+ catch (AppiaEventException e)
+ {
+ e.printStackTrace();
+ }
}
}
@@ -415,10 +424,26 @@
e1.printStackTrace();
}
}
- myAddress = vs.addresses[ls.my_rank];
- appiaGMS.setLocalAddress(myAddress);
- // TODO: send a clone of the event?
- appiaGMS.addToMailbox(e);
+
+ if(requestedDisconnect)
+ {
+ try
+ {
+ (new LeaveEvent(channel, Direction.DOWN, this, myGroup, vs.id)).go();
+ requestedDisconnect = false;
+ }
+ catch (AppiaEventException ex)
+ {
+ ex.printStackTrace();
+ }
+ }
+ else
+ {
+ myAddress = vs.addresses[ls.my_rank];
+ appiaGMS.setLocalAddress(myAddress);
+ // TODO: send a clone of the event?
+ appiaGMS.addToMailbox(e);
+ }
}
/*
|