Spelling fixes in log messages, made a delay windows-only which according to a comment should be windows-only, fixed a random filename generator.

This commit is contained in:
jaseg 2011-11-09 17:19:00 +01:00
parent bf0fe9377d
commit 4fc4a35381
3 changed files with 27 additions and 25 deletions

View File

@ -81,10 +81,9 @@ exports.doExport = function(req, res, padId, type)
res.send(html); res.send(html);
callback("stop"); callback("stop");
} }
//write the html export to a file else //write the html export to a file
else
{ {
randNum = Math.floor(Math.random()*new Date().getTime()); randNum = Math.floor(Math.random()*0xFFFFFFFF);
srcFile = tempDirectory + "/eplite_export_" + randNum + ".html"; srcFile = tempDirectory + "/eplite_export_" + randNum + ".html";
fs.writeFile(srcFile, html, callback); fs.writeFile(srcFile, html, callback);
} }
@ -114,10 +113,13 @@ exports.doExport = function(req, res, padId, type)
function(callback) function(callback)
{ {
//100ms delay to accomidate for slow windows fs //100ms delay to accomidate for slow windows fs
setTimeout(function() if(os.type().indexOf("Windows") > -1)
{ {
fs.unlink(destFile, callback); setTimeout(function()
}, 100); {
fs.unlink(destFile, callback);
}, 100);
}
} }
], callback); ], callback);
} }

View File

@ -193,7 +193,7 @@ exports.handleMessage = function(client, message)
//if the message type is unkown, throw an exception //if the message type is unkown, throw an exception
else else
{ {
messageLogger.warn("Droped message, unkown Message Type " + message.type); messageLogger.warn("Dropped message, unkown Message Type " + message.type);
} }
} }
@ -272,12 +272,12 @@ function handleSuggestUserName(client, message)
//check if all ok //check if all ok
if(message.data.payload.newName == null) if(message.data.payload.newName == null)
{ {
messageLogger.warn("Droped message, suggestUserName Message has no newName!"); messageLogger.warn("Dropped message, suggestUserName Message has no newName!");
return; return;
} }
if(message.data.payload.unnamedId == null) if(message.data.payload.unnamedId == null)
{ {
messageLogger.warn("Droped message, suggestUserName Message has no unnamedId!"); messageLogger.warn("Dropped message, suggestUserName Message has no unnamedId!");
return; return;
} }
@ -304,7 +304,7 @@ function handleUserInfoUpdate(client, message)
//check if all ok //check if all ok
if(message.data.userInfo.colorId == null) if(message.data.userInfo.colorId == null)
{ {
messageLogger.warn("Droped message, USERINFO_UPDATE Message has no colorId!"); messageLogger.warn("Dropped message, USERINFO_UPDATE Message has no colorId!");
return; return;
} }
@ -348,17 +348,17 @@ function handleUserChanges(client, message)
//check if all ok //check if all ok
if(message.data.baseRev == null) if(message.data.baseRev == null)
{ {
messageLogger.warn("Droped message, USER_CHANGES Message has no baseRev!"); messageLogger.warn("Dropped message, USER_CHANGES Message has no baseRev!");
return; return;
} }
if(message.data.apool == null) if(message.data.apool == null)
{ {
messageLogger.warn("Droped message, USER_CHANGES Message has no apool!"); messageLogger.warn("Dropped message, USER_CHANGES Message has no apool!");
return; return;
} }
if(message.data.changeset == null) if(message.data.changeset == null)
{ {
messageLogger.warn("Droped message, USER_CHANGES Message has no changeset!"); messageLogger.warn("Dropped message, USER_CHANGES Message has no changeset!");
return; return;
} }
@ -600,22 +600,22 @@ function handleClientReady(client, message)
//check if all ok //check if all ok
if(!message.token) if(!message.token)
{ {
messageLogger.warn("Droped message, CLIENT_READY Message has no token!"); messageLogger.warn("Dropped message, CLIENT_READY message has no token!");
return; return;
} }
if(!message.padId) if(!message.padId)
{ {
messageLogger.warn("Droped message, CLIENT_READY Message has no padId!"); messageLogger.warn("Dropped message, CLIENT_READY message has no padId!");
return; return;
} }
if(!message.protocolVersion) if(!message.protocolVersion)
{ {
messageLogger.warn("Droped message, CLIENT_READY Message has no protocolVersion!"); messageLogger.warn("Dropped message, CLIENT_READY message has no protocolVersion!");
return; return;
} }
if(message.protocolVersion != 2) if(message.protocolVersion != 2)
{ {
messageLogger.warn("Droped message, CLIENT_READY Message has a unkown protocolVersion '" + message.protocolVersion + "'!"); messageLogger.warn("Dropped message, CLIENT_READY message has an unkown protocolVersion '" + message.protocolVersion + "'!");
return; return;
} }

View File

@ -77,7 +77,7 @@ exports.handleMessage = function(client, message)
//if the message type is unkown, throw an exception //if the message type is unkown, throw an exception
else else
{ {
messageLogger.warn("Droped message, unkown Message Type: '" + message.type + "'"); messageLogger.warn("Dropped message, unkown Message Type: '" + message.type + "'");
} }
} }
@ -85,7 +85,7 @@ function handleClientReady(client, message)
{ {
if(message.padId == null) if(message.padId == null)
{ {
messageLogger.warn("Droped message, changeset request has no padId!"); messageLogger.warn("Dropped message, changeset request has no padId!");
return; return;
} }
@ -106,27 +106,27 @@ function handleChangesetRequest(client, message)
//check if all ok //check if all ok
if(message.data == null) if(message.data == null)
{ {
messageLogger.warn("Droped message, changeset request has no data!"); messageLogger.warn("Dropped message, changeset request has no data!");
return; return;
} }
if(message.padId == null) if(message.padId == null)
{ {
messageLogger.warn("Droped message, changeset request has no padId!"); messageLogger.warn("Dropped message, changeset request has no padId!");
return; return;
} }
if(message.data.granularity == null) if(message.data.granularity == null)
{ {
messageLogger.warn("Droped message, changeset request has no granularity!"); messageLogger.warn("Dropped message, changeset request has no granularity!");
return; return;
} }
if(message.data.start == null) if(message.data.start == null)
{ {
messageLogger.warn("Droped message, changeset request has no start!"); messageLogger.warn("Dropped message, changeset request has no start!");
return; return;
} }
if(message.data.requestID == null) if(message.data.requestID == null)
{ {
messageLogger.warn("Droped message, changeset request has no requestID!"); messageLogger.warn("Dropped message, changeset request has no requestID!");
return; return;
} }