Skip to content

Commit cedcf0c

Browse files
committed
fix jshint errors for lib/connection.js
1 parent 74c8945 commit cedcf0c

File tree

1 file changed

+17
-16
lines changed

1 file changed

+17
-16
lines changed

lib/connection.js

+17-16
Original file line numberDiff line numberDiff line change
@@ -80,10 +80,11 @@ p.attachListeners = function(stream) {
8080
var self = this;
8181
stream.on('data', function(buffer) {
8282
self.setBuffer(buffer);
83-
var msg;
84-
while(msg = self.parseMessage()) {
83+
var msg = self.parseMessage();
84+
while(msg) {
8585
self.emit('message', msg);
8686
self.emit(msg.name, msg);
87+
msg = self.parseMessage();
8788
}
8889
});
8990
};
@@ -102,7 +103,7 @@ p.requestSsl = function(config) {
102103
.add(bodyBuffer)
103104
.join();
104105
this.stream.write(buffer);
105-
}
106+
};
106107

107108
p.startup = function(config) {
108109
var bodyBuffer = this.writer
@@ -147,13 +148,13 @@ p.password = function(password) {
147148
};
148149

149150
p._send = function(code, more) {
150-
if(!this.stream.writable) return false;
151+
if(!this.stream.writable) { return false; }
151152
if(more === true) {
152153
this.writer.addHeader(code);
153154
} else {
154155
return this.stream.write(this.writer.flush(code));
155156
}
156-
}
157+
};
157158

158159
p.query = function(text) {
159160
//0x51 = Q
@@ -239,13 +240,13 @@ var emptyBuffer = Buffer(0);
239240

240241
p.flush = function() {
241242
//0x48 = 'H'
242-
this.writer.add(emptyBuffer)
243+
this.writer.add(emptyBuffer);
243244
this._send(0x48);
244-
}
245+
};
245246

246247
p.sync = function() {
247248
//clear out any pending data in the writer
248-
this.writer.flush(0)
249+
this.writer.flush(0);
249250

250251
this.writer.add(emptyBuffer);
251252
this._send(0x53);
@@ -263,15 +264,15 @@ p.describe = function(msg, more) {
263264
};
264265
p.sendCopyFromChunk = function (chunk) {
265266
this.stream.write(this.writer.add(chunk).flush(0x64));
266-
}
267+
};
267268
p.endCopyFrom = function () {
268269
this.stream.write(this.writer.add(emptyBuffer).flush(0x63));
269-
}
270+
};
270271
p.sendCopyFail = function (msg) {
271272
//this.stream.write(this.writer.add(emptyBuffer).flush(0x66));
272273
this.writer.addCString(msg);
273274
this._send(0x66);
274-
}
275+
};
275276
//parsing methods
276277
p.setBuffer = function(buffer) {
277278
if(this.lastBuffer) { //we have unfinished biznaz
@@ -476,8 +477,8 @@ p.parseD = function(msg) {
476477
var fields = [];
477478
for(var i = 0; i < fieldCount; i++) {
478479
var length = this.parseInt32();
479-
fields[i] = (length === -1 ? null : this.readBytes(length))
480-
};
480+
fields[i] = (length === -1 ? null : this.readBytes(length));
481+
}
481482
msg.fieldCount = fieldCount;
482483
msg.fields = fields;
483484
return msg;
@@ -542,7 +543,7 @@ p.parseInt8 = function () {
542543
var value = Number(this.buffer[this.offset]);
543544
this.offset++;
544545
return value;
545-
}
546+
};
546547
p.readChar = function() {
547548
return Buffer([this.buffer[this.offset++]]).toString(this.encoding);
548549
};
@@ -578,13 +579,13 @@ p.readBytes = function(length) {
578579

579580
p.parseCString = function() {
580581
var start = this.offset;
581-
while(this.buffer[this.offset++]) { };
582+
while(this.buffer[this.offset++]) { }
582583
return this.buffer.toString(this.encoding, start, this.offset - 1);
583584
};
584585
p.parsed = function (msg) {
585586
//exclude length field
586587
msg.chunk = this.readBytes(msg.length - 4);
587588
return msg;
588-
}
589+
};
589590
//end parsing methods
590591
module.exports = Connection;

0 commit comments

Comments
 (0)