summaryrefslogtreecommitdiffstats
path: root/protocol/smppclient.class.php
diff options
context:
space:
mode:
authorHans Duedal <hd@onlinecity.dk>2011-07-22 15:54:39 +0200
committerHans Duedal <hd@onlinecity.dk>2011-07-22 15:54:39 +0200
commit61c99fc84e22696a84b45661ac223dfb5911e849 (patch)
treea34eb306c912db41b61b1823d6e539dadcaca9ee /protocol/smppclient.class.php
parent5dc4d005549bb51d6d7fa1532a3be142f301cc73 (diff)
downloadphp-smpp-61c99fc84e22696a84b45661ac223dfb5911e849.zip
php-smpp-61c99fc84e22696a84b45661ac223dfb5911e849.tar.gz
php-smpp-61c99fc84e22696a84b45661ac223dfb5911e849.tar.bz2
Added check for missing reply to bind command
Diffstat (limited to 'protocol/smppclient.class.php')
-rw-r--r--protocol/smppclient.class.php12
1 files changed, 5 insertions, 7 deletions
diff --git a/protocol/smppclient.class.php b/protocol/smppclient.class.php
index 4e083e4..945f247 100644
--- a/protocol/smppclient.class.php
+++ b/protocol/smppclient.class.php
@@ -162,18 +162,15 @@ class SmppClient
$pdu = $this->readPDU();
if ($pdu === false) return false; // TSocket v. 0.6.0+ returns false on timeout
//check for enquire link command
- if($pdu->id==SMPP::ENQUIRE_LINK){
+ if($pdu->id==SMPP::ENQUIRE_LINK) {
$response = new SmppPdu(SMPP::ENQUIRE_LINK_RESP, SMPP::ESME_ROK, $pdu->sequence, "\x00");
$this->sendPDU($response);
- return false;
+ } else if ($pdu->id!=$command_id) { // if this is not the correct PDU add to queue
+ array_push($this->pdu_queue, $pdu);
}
- array_push($this->pdu_queue, $pdu);
} while($pdu && $pdu->id!=$command_id);
- if($pdu) {
- array_pop($this->pdu_queue);
- return $this->parseSMS($pdu);
- }
+ if($pdu) return $this->parseSMS($pdu);
return false;
}
@@ -489,6 +486,7 @@ class SmppClient
$pdu = new SmppPdu($id, 0, $this->sequence_number, $pduBody);
$this->sendPDU($pdu);
$response=$this->readPDU_resp($this->sequence_number, $pdu->id);
+ if ($response === false) throw new SmppException('Failed to read reply to command: 0x'.dechex($id));
if ($response->status != SMPP::ESME_ROK) throw new SmppException(SMPP::getStatusMessage($response->status), $response->status);