Revision: 16185
Author: baranowb
Date: Wed Jan  5 07:52:05 2011
Log: Fixes Issue 2238
As above.
Adds static definition of values and sends proper code.
http://code.google.com/p/mobicents/source/detail?r=16185

Added:
/trunk/servers/diameter/core/jdiameter/api/src/main/java/org/jdiameter/api/DisconnectCause.java
Modified:
/trunk/servers/diameter/core/jdiameter/impl/src/main/java/org/jdiameter/client/impl/fsm/PeerFSMImpl.java /trunk/servers/diameter/core/jdiameter/impl/src/main/java/org/jdiameter/server/impl/fsm/PeerFSMImpl.java

=======================================
--- /dev/null
+++ /trunk/servers/diameter/core/jdiameter/api/src/main/java/org/jdiameter/api/DisconnectCause.java Wed Jan 5 07:52:05 2011
@@ -0,0 +1,49 @@
+/*
+ * JBoss, Home of Professional Open Source
+ *
+ * Copyright 2010, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a full listing
+ * of individual contributors.
+ *
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU General Public License, v. 2.0.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License,
+ * v. 2.0 along with this distribution; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ */
+package org.jdiameter.api;
+
+/**
+ * Interface defining disconnect cause codes
+ *
+ * @author <a href="mailto:[email protected]";> Alexandre Mendonca </a>
+ */
+public interface DisconnectCause {
+
+  /**
+   * A scheduled reboot is imminent.
+   */
+  public static final int REBOOTING = 0;
+
+  /**
+   * The peer's internal resources are constrained, and it has
+   * determined that the transport connection needs to be closed.
+   */
+  public static final int BUSY = 1;
+
+  /**
+   * The peer has determined that it does not see a need for the
+   * transport connection to exist, since it does not expect any
+   * messages to be exchanged in the near future.
+   */
+  public static final int DO_NOT_WANT_TO_TALK_TO_YOU = 2;
+}
=======================================
--- /trunk/servers/diameter/core/jdiameter/impl/src/main/java/org/jdiameter/client/impl/fsm/PeerFSMImpl.java Fri Nov 26 03:59:43 2010 +++ /trunk/servers/diameter/core/jdiameter/impl/src/main/java/org/jdiameter/client/impl/fsm/PeerFSMImpl.java Wed Jan 5 07:52:05 2011
@@ -27,10 +27,10 @@
 import java.util.concurrent.locks.ReentrantLock;

 import org.jdiameter.api.Configuration;
+import org.jdiameter.api.DisconnectCause;
 import org.jdiameter.api.Message;
 import org.jdiameter.api.OverloadException;
 import org.jdiameter.api.PeerState;
-import org.jdiameter.api.ResultCode;
 import org.jdiameter.api.app.State;
 import org.jdiameter.api.app.StateChangeListener;
 import org.jdiameter.api.app.StateEvent;
@@ -338,7 +338,7 @@
                 break;
               case STOP_EVENT:
                 try {
-                  context.sendDprMessage(ResultCode.SUCCESS);
+ context.sendDprMessage(DisconnectCause.DO_NOT_WANT_TO_TALK_TO_YOU);
                   setTimer(DPA_TIMEOUT);
                   switchToNextState(FsmState.STOPPING);
                 }
@@ -413,7 +413,7 @@
                 break;
               case STOP_EVENT:
                 try {
-                  context.sendDprMessage(ResultCode.SUCCESS);
+ context.sendDprMessage(DisconnectCause.DO_NOT_WANT_TO_TALK_TO_YOU);
                   setInActiveTimer();
                   switchToNextState(FsmState.STOPPING);
                 }
=======================================
--- /trunk/servers/diameter/core/jdiameter/impl/src/main/java/org/jdiameter/server/impl/fsm/PeerFSMImpl.java Tue Nov 2 17:28:34 2010 +++ /trunk/servers/diameter/core/jdiameter/impl/src/main/java/org/jdiameter/server/impl/fsm/PeerFSMImpl.java Wed Jan 5 07:52:05 2011
@@ -2,6 +2,7 @@

 import org.jdiameter.api.Configuration;
 import org.jdiameter.api.ConfigurationListener;
+import org.jdiameter.api.DisconnectCause;
 import org.jdiameter.api.MutableConfiguration;
 import org.jdiameter.api.ResultCode;
 import org.jdiameter.api.app.State;
@@ -71,7 +72,7 @@
                 break;
               case STOP_EVENT:
                 try { // TODO: send user code;
-                  context.sendDprMessage(ResultCode.SUCCESS);
+ context.sendDprMessage(DisconnectCause.DO_NOT_WANT_TO_TALK_TO_YOU);
                   setTimer(DPA_TIMEOUT);
                   switchToNextState(STOPPING);
                 }
@@ -152,7 +153,7 @@
                 break;
               case STOP_EVENT:
                 try {
-                  context.sendDprMessage(ResultCode.SUCCESS);
+ context.sendDprMessage(DisconnectCause.DO_NOT_WANT_TO_TALK_TO_YOU);
                   setInActiveTimer();
                   switchToNextState(STOPPING);
                 }

Reply via email to