Skip to content

Commit

Permalink
Merge branch 'master' into feature/timeout
Browse files Browse the repository at this point in the history
# Conflicts:
#	README.md
#	lib/smpp.js
#	test/smpp.js
  • Loading branch information
rmruano committed Sep 27, 2021
2 parents 7a4b081 + 4ea9684 commit 3ce9e7c
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 13 deletions.
7 changes: 2 additions & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,12 @@ node_js:
- '0.10'
- 0.12
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 16

script:
- npm run-script cover
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ node-smpp
=========
SMPP client and server implementation in node.js.

[![Build Status](https://travis-ci.org/farhadi/node-smpp.png)](https://travis-ci.org/farhadi/node-smpp)
[![Build Status](https://api.travis-ci.com/farhadi/node-smpp.svg?branch=master)](https://app.travis-ci.com/github/farhadi/node-smpp)
[![Dependency Status](https://david-dm.org/farhadi/node-smpp.svg)](https://david-dm.org/farhadi/node-smpp)
[![devDependency Status](https://david-dm.org/farhadi/node-smpp/dev-status.svg)](https://david-dm.org/farhadi/node-smpp#info=devDependencies)
[![Coverage Status](https://coveralls.io/repos/github/farhadi/node-smpp/badge.svg?branch=master)](https://coveralls.io/github/farhadi/node-smpp?branch=master)
Expand All @@ -18,7 +18,7 @@ implementations as far as you don't use TLV parameters and don't bind in transce

The name of the methods and parameters in this implementation are equivalent to
the names defined in SMPP specification. So get a copy of
[SMPP v5.0 Specification](http://farhadi.ir/downloads/smppv50.pdf)
[SMPP v5.0 Specification](https://smpp.org/SMPP_v5.pdf)
for a list of available operations and their parameters.

Installation
Expand Down
11 changes: 6 additions & 5 deletions lib/smpp.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ var net = require('net'),
PDU = require('./pdu').PDU,
EventEmitter = require('events').EventEmitter;

function Session(mode, options) {
function Session(options) {
EventEmitter.call(this);
this.options = options || {};
var self = this;
Expand All @@ -20,14 +20,16 @@ function Session(mode, options) {
this._callbacks = {};
this._interval = 0;
this._command_length = null;
this._mode = mode;
this._mode = null;
this._id = Math.floor(Math.random() * (999999 - 100000)) + 100000; // random session id
this._prevBytesRead = 0;
if (options.socket) {
// server mode
this._mode = "server";
this.socket = options.socket;
} else {
// client mode
this._mode = "client";
if (options.tls) {
transport = tls;
}
Expand Down Expand Up @@ -84,7 +86,6 @@ function Session(mode, options) {
this.socket.on('error', function(e) {
clearTimeout(connectTimeout);
self.debug("socket.error", e.message, e);
if (self.socket) self.socket.destroy();
if(self._interval) {
clearInterval(self._interval);
self._interval = 0;
Expand Down Expand Up @@ -256,7 +257,7 @@ function Server(options, listener) {
this.options = options;

transport.Server.call(this, options, function(socket) {
var session = new Session("server", {socket: socket, debug: self.options.debug});
var session = new Session({socket: socket, debug: self.options.debug});
session.debug("client.connected", "client has connected");
session.server = self;
self.sessions.push(session);
Expand Down Expand Up @@ -330,7 +331,7 @@ exports.connect = exports.createSession = function(url, listener) {
options.debug = options.debug || false;
options.connectTimeout = options.connectTimeout || 30000;

var session = new Session("client", options);
var session = new Session(options);
if (listener) {
session.on(options.tls ? 'secureConnect' : 'connect', listener);
}
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "smpp",
"version": "0.5.0",
"version": "0.5.1",
"description": "SMPP client and server implementation in node.js",
"homepage": "https://github.com/farhadi/node-smpp",
"bugs": "https://github.com/farhadi/node-smpp/issues",
Expand Down

0 comments on commit 3ce9e7c

Please sign in to comment.