Created
March 7, 2012 14:00
-
-
Save ffissore/1993310 to your computer and use it in GitHub Desktop.
Shutdown.coffee
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
parser = require("../connection/parser") | |
OperationTypes = require("./operation_types") | |
class Shutdown | |
read: (data, callback) -> | |
status = data.readUInt8(0) | |
if status | |
callback(data) | |
return | |
callback() | |
return | |
write: (socket, sessionId, data, callback) -> | |
#operation type | |
socket.write(parser.writeByte(OperationTypes.SHUTDOWN, true)) | |
#invoke callback imidiately when the operation is sent to the server | |
callback() | |
#session ID | |
socket.write(parser.writeInt(sessionId, true)) | |
#user name | |
socket.write(parser.writeString(data.user_name)) | |
#user password | |
socket.write(parser.writeString(data.user_password)) | |
return | |
module.exports = Shutdown |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment