Skip to content

Commit

Permalink
Simplifying.
Browse files Browse the repository at this point in the history
  • Loading branch information
farhadi committed Mar 13, 2013
1 parent 558d468 commit 4c47ace
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions lib/smpp.js
Expand Up @@ -16,16 +16,13 @@ function Session(options) {
} else { } else {
this.port = options.port; this.port = options.port;
this.host = options.host; this.host = options.host;
this.socket = net.createConnection(this.port, this.host); this.socket = net.connect(this.port, this.host);
this.socket.on('connect', function() { this.socket.on('connect', function() {
self.emit('connect'); self.emit('connect');
}); });
} }
this.socket.on('data', function(chunk) { this.socket.on('data', function(chunk) {
var oldBuffer = self._buffer; self._buffer = Buffer.concat([self._buffer, chunk]);
self._buffer = new Buffer(oldBuffer.length + chunk.length);
oldBuffer.copy(self._buffer);
chunk.copy(self._buffer, oldBuffer.length);
self._extractPDUs(); self._extractPDUs();
}); });
this.socket.on('close', function() { this.socket.on('close', function() {
Expand Down

0 comments on commit 4c47ace

Please sign in to comment.