Skip to content

Commit

Permalink
Prepared cloudjs for tunneling possibility
Browse files Browse the repository at this point in the history
  • Loading branch information
digitalwm committed Feb 27, 2012
1 parent f20e099 commit 335862a
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions cloudjs.js
Expand Up @@ -464,14 +464,14 @@ Clouder.prototype.connect = function () {
if(self.messagesInjected.removeElement(buf.toString().hashCode()) === true) { if(self.messagesInjected.removeElement(buf.toString().hashCode()) === true) {
return; return;
} }
self.emit("rawdata", buf);


if(self._hasEncription === true) { if(self._hasEncription === true) {
mode = new crypto.mode.ECB(crypto.pad.pkcs7); mode = new crypto.mode.ECB(crypto.pad.pkcs7);
dataBytes = crypto.util.hexToBytes(buf.toString()); dataBytes = crypto.util.hexToBytes(buf.toString());
dataDecripted = crypto.DES.decrypt(dataBytes, self._encryptionKey, {asBytes: true, mode: mode}); dataDecripted = crypto.DES.decrypt(dataBytes, self._encryptionKey, {asBytes: true, mode: mode});
buf = crypto.charenc.UTF8.bytesToString(dataDecripted); buf = crypto.charenc.UTF8.bytesToString(dataDecripted);
} }
self.emit("rawdata", buf.toString());
msg = serializer.parse(buf); msg = serializer.parse(buf);
if(typeof(msg.type) === 'undefined' || typeof(msg.title) === 'undefined' || typeof(msg.body) === 'undefined') { if(typeof(msg.type) === 'undefined' || typeof(msg.title) === 'undefined' || typeof(msg.body) === 'undefined') {
return; return;
Expand Down Expand Up @@ -600,10 +600,8 @@ Clouder.prototype.connect = function () {
}; };


this.inject = function(data) { this.inject = function(data) {
var messageBuffer; this.messagesInjected.push(data.toString().hashCode());
messageBuffer = new Buffer(data); this.socket.send(data, 0, data.length, this.port, this.group);
this.messagesInjected.push(messageBuffer.toString().hashCode());
this.socket.send(messageBuffer, 0, messageBuffer.length, this.port, this.group);
}; };


this.sendWithCallback = function(title, message, callback, timeout) { this.sendWithCallback = function(title, message, callback, timeout) {
Expand Down

0 comments on commit 335862a

Please sign in to comment.