Skip to content
This repository was archived by the owner on Nov 28, 2018. It is now read-only.

Commit 116659a

Browse files
committed
Cleanup stuff while I try to find a style I like..
1 parent 04e9901 commit 116659a

File tree

4 files changed

+13
-20
lines changed

4 files changed

+13
-20
lines changed

lib/frame.js

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
require('sys');
2-
require('./stomp-utils');
3-
require('./stomp-exceptions');
1+
var sys = require('sys'),
2+
utils = require('./stomp-utils'),
3+
exceptions = require('./stomp-exceptions');
44

55

66
Frame = module.exports = function(logger) {
@@ -33,9 +33,9 @@ Frame.prototype.build_frame = function(args, want_receipt) {
3333
var receipt_stamp = null;
3434

3535
if (want_receipt) {
36-
receipt_stamp = Math.floor(Math.random()*10000000+1);
37-
this.headers['receipt'] = this.session['session'] + '-' + receipt_stamp;
38-
this.stomp_log.debug(want_receipt);
36+
receipt_stamp = Math.floor(Math.random()*10000000+1);
37+
this.headers['receipt'] = this.session['session'] + '-' + receipt_stamp;
38+
this.stomp_log.debug(want_receipt);
3939
}
4040

4141
return this;
@@ -81,21 +81,18 @@ Frame.prototype.parse_frame = function(data) {
8181
if ('content-length' in this.headers)
8282
this.headers['bytes_message'] = true;
8383

84-
if (this.command == 'ERROR') {
84+
if (this.command == 'ERROR')
8585
throw new BrokerErrorResponse(this.body);
86-
}
8786

8887
args['command'] = this.command;
8988
args['headers'] = this.headers;
9089
args['body'] = this.body;
9190

9291
this_frame = new Frame(this.sock);
9392
return this_frame.build_frame(args);
94-
9593
};
9694

9795
Frame.prototype.parse_headers = function(headers_str) {
98-
9996
var these_headers = Array(),
10097
one_header = Array(),
10198
headers_split = headers_str.split('\n');
@@ -111,18 +108,13 @@ Frame.prototype.parse_headers = function(headers_str) {
111108
else {
112109
these_headers[one_header[0]] = one_header[1];
113110
}
114-
115111
}
116-
117112
return these_headers;
118-
119113
};
120114

121115
Frame.prototype.parse_command = function(data) {
122-
123116
var command,
124117
this_string = data.toString('ascii', start=0, end=data.length);
125118
command = this_string.split('\n');
126119
return command[0];
127-
128120
};

lib/stomp-exceptions.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
BrokerErrorResponse = exports.BrokerErrorResponse = function(value) {
2+
23
this.value = value;
34
this.message = "Broker returned error: " + this.value
45
console.error(this.message + this.value);
6+
57
};
68

lib/stomp.js

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
var net = require('net');
2-
require('./frame');
3-
require('./stomp-utils');
1+
var net = require('net'),
2+
frame = require('./frame'),
3+
utils = require('./stomp-utils'),
4+
exceptions = require('./stomp-exceptions');
45

56
Stomp = module.exports = function(port, host, debug) {
67
this.port = port;
@@ -13,7 +14,6 @@ Stomp = module.exports = function(port, host, debug) {
1314
};
1415

1516
Stomp.prototype.connect = function() {
16-
1717
this.stomp_log.debug('Connecting to ' + this.host + ':' + this.port);
1818
var client = net.createConnection(this.port, this.host);
1919
var _stomp = this;
@@ -34,5 +34,4 @@ Stomp.prototype.connect = function() {
3434
client.addListener('close', function (error) {
3535
_stomp.stomp_log.debug('disconnected');
3636
});
37-
3837
};

stomp-client.js

100644100755
File mode changed.

0 commit comments

Comments
 (0)