Permalink
Browse files

Simplifying.

  • Loading branch information...
1 parent 558d468 commit 4c47ace1f0f5030dca5a98929cdfb94a409277e2 @farhadi committed Mar 13, 2013
Showing with 2 additions and 5 deletions.
  1. +2 −5 lib/smpp.js
View
@@ -16,16 +16,13 @@ function Session(options) {
} else {
this.port = options.port;
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() {
self.emit('connect');
});
}
this.socket.on('data', function(chunk) {
- var oldBuffer = self._buffer;
- self._buffer = new Buffer(oldBuffer.length + chunk.length);
- oldBuffer.copy(self._buffer);
- chunk.copy(self._buffer, oldBuffer.length);
+ self._buffer = Buffer.concat([self._buffer, chunk]);
self._extractPDUs();
});
this.socket.on('close', function() {

0 comments on commit 4c47ace

Please sign in to comment.