From 802d5db3394a73a311bc40022ebc8e2811a72178 Mon Sep 17 00:00:00 2001 From: "Mikael.Thyman" Date: Wed, 23 Sep 2015 16:51:20 +0200 Subject: [PATCH] Using timeoutMillis in sendRequestPd --- .../java/com/cloudhopper/smpp/impl/DefaultSmppSession.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/cloudhopper/smpp/impl/DefaultSmppSession.java b/src/main/java/com/cloudhopper/smpp/impl/DefaultSmppSession.java index 66ff11b7..beafeb03 100644 --- a/src/main/java/com/cloudhopper/smpp/impl/DefaultSmppSession.java +++ b/src/main/java/com/cloudhopper/smpp/impl/DefaultSmppSession.java @@ -527,7 +527,12 @@ public WindowFuture sendRequestPdu(PduRequest pd } // write the pdu out & wait timeout amount of time - ChannelFuture channelFuture = this.channel.write(buffer).await(); + ChannelFuture channelFuture = this.channel.write(buffer); + boolean timedOut = !channelFuture.await(timeoutMillis); + + if (timedOut) { + throw new SmppChannelException("Send timed out for PDU: " + pdu); + } // check if the write was a success if (!channelFuture.isSuccess()) {