Permalink
Browse files

Included windowSize on async response

  • Loading branch information...
jjlauer committed May 9, 2011
1 parent 712446a commit 45e8cc0c9ff308879e0af21ba4a198d529a298b7
View
@@ -3,7 +3,7 @@ http://twitter.com/
http://www.cloudhopper.com/
SMPP Library
--------------------------------------------------------------------------------
-4.0 - 2011-05-05
+4.0 - 2011-05-09
* Upgraded ch-commons-util dependency from 4.1 to 5.0
* WARN: There are some minor source and binary backwards compatability issues
that were unavoidable to add request expiry as a new feature.
@@ -26,6 +26,8 @@ SMPP Library
explictly register/unregister.
* Added 3 new time measurements on asynchronous responses (window wait time,
response time, and estimated processing time).
+ * PduAsyncResponse now includes "getWindowSize" which returns the size of the
+ window after adding this response. Used to estimate processing time.
* Modified internals of SmppSession to call the "requestWindow"
a "sendWindow". Since either endpoint of a session can technically
generate requests, this actually represents the window just for sending.
@@ -37,6 +37,12 @@
* @return The response
*/
public PduResponse getResponse();
+
+ /**
+ * Gets the size of the window after this request was added.
+ * @return The size of the window after this request was added.
+ */
+ public int getWindowSize();
/**
* Gets the amount of time required to accept the request into the session
@@ -43,6 +43,11 @@ public PduResponse getResponse() {
return future.getResponse();
}
+ @Override
+ public int getWindowSize() {
+ return future.getWindowSize();
+ }
+
@Override
public long getWindowWaitTime() {
return future.getOfferToAcceptTime();
@@ -67,6 +72,8 @@ public String toString() {
StringBuilder buf = new StringBuilder(100);
buf.append("smpp_async_resp: seqNum [0x");
buf.append(HexUtil.toHexString(this.future.getKey()));
+ buf.append("] windowSize [");
+ buf.append(getWindowSize());
buf.append("] windowWaitTime [");
buf.append(getWindowWaitTime());
buf.append(" ms] responseTime [");
@@ -23,6 +23,7 @@
import com.cloudhopper.smpp.impl.DefaultSmppSessionHandler;
import com.cloudhopper.smpp.pdu.BaseBind;
import com.cloudhopper.smpp.pdu.BaseBindResp;
+import com.cloudhopper.smpp.pdu.BaseSm;
import com.cloudhopper.smpp.pdu.PduRequest;
import com.cloudhopper.smpp.pdu.PduResponse;
import com.cloudhopper.smpp.type.SmppProcessingException;
@@ -145,13 +146,14 @@ public PduResponse firePduRequestReceived(PduRequest pduRequest) {
//Thread.sleep(50);
} catch (Exception e) { }
- if (session != null) {
- //logger.debug("rx-enquireLink: {}", session.getCounters().getRxEnquireLink());
- //logger.debug("rx-submitSM: {}", session.getCounters().getRxSubmitSM());
+ // do not respond to a submit
+ if (pduRequest instanceof BaseSm) {
+ logger.warn("Ignoring request by not returning a response");
+ return null;
+ } else {
+ // ignore for now (already logged)
+ return pduRequest.createResponse();
}
-
- // ignore for now (already logged)
- return pduRequest.createResponse();
}
}

0 comments on commit 45e8cc0

Please sign in to comment.