Skip to content
This repository has been archived by the owner on Nov 1, 2022. It is now read-only.

Commit

Permalink
bug fixes; updated server-example.js
Browse files Browse the repository at this point in the history
  • Loading branch information
bjyoungblood committed Jan 23, 2011
1 parent 71c6a4d commit a8fd2f1
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
7 changes: 4 additions & 3 deletions lib/models/serverClient.js
Expand Up @@ -167,7 +167,7 @@ var serverClient = function(socket, server, closeConnectionServerCallback, callb

// fire the callback
if (typeof self.callbacks['receiveOutgoing'] == 'function') {
self.callbacks['receiveOutgoing'](mySms, self.submitResponse);
self.callbacks['receiveOutgoing'](mySms, self, self.submitResponse);
}
};

Expand Down Expand Up @@ -293,7 +293,7 @@ var serverClient = function(socket, server, closeConnectionServerCallback, callb
* Create a new PDU with our response
*/
if (bindAllowed) {
var newPdu = smpp.bind_resp(myPdu.command_id, self.sequence_number, self.config.system_id);
var newPdu = smpp.bind_resp(myPdu.command_id, myPdu.sequence_number, self.config.system_id);
self.bound = true;
self.socket.setTimeout(self.config.timeout * 1000);
self.socket.on('timeout', self.enquire_link);
Expand All @@ -302,7 +302,7 @@ var serverClient = function(socket, server, closeConnectionServerCallback, callb
// were incorrect (if they were). the Shorty developers think that this is a bad security practice
// so we offer another option
if (self.config.strict == 1) {
var newPdu = smpp.bind_resp(myPdu.command_id, self.sequence_number, self.config.system_id, true);
var newPdu = smpp.bind_resp(myPdu.command_id, myPdu.sequence_number, self.config.system_id, true);
} else {

// outside of strict mode, Shorty will reject this connection, meaning that all incoming data
Expand All @@ -315,6 +315,7 @@ var serverClient = function(socket, server, closeConnectionServerCallback, callb
self.rejected = true;
// slow down attackers
setTimeout(self.socket.end, 10000);
return;
}
}

Expand Down
2 changes: 1 addition & 1 deletion server-example.js
Expand Up @@ -35,7 +35,7 @@ shortyServer.clientOn('deliverySuccess', function(mySms) {
console.log("sms marked as delivered: " + mySms.user_ref);
});

shortyServer.clientOn('receiveOutgoing', function(mySms, responseCallback) {
shortyServer.clientOn('receiveOutgoing', function(mySms, clientData, responseCallback) {
console.log(sys.inspect(mySms));
if (mySms.sender == "15555551234") {
// indicate failure
Expand Down

0 comments on commit a8fd2f1

Please sign in to comment.