OCA_Backend/api/node_modules/mysql2/lib/commands/quit.js

30 lines
563 B
JavaScript
Raw Normal View History

2022-01-22 13:36:44 +00:00
'use strict';
const Command = require('./command.js');
const CommandCode = require('../constants/commands.js');
const Packet = require('../packets/packet.js');
class Quit extends Command {
constructor(callback) {
super();
this.done = callback;
}
start(packet, connection) {
connection._closing = true;
const quit = new Packet(
0,
Buffer.from([1, 0, 0, 0, CommandCode.QUIT]),
0,
5
);
if (this.done) {
this.done();
}
connection.writePacket(quit);
return null;
}
}
module.exports = Quit;