chore(socket) add " "

This commit is contained in:
coderaiser 2013-10-23 11:39:48 +00:00
parent c566639c32
commit bb7156df5e

View file

@ -1,6 +1,6 @@
/* module make possible connectoin thru socket.io on a server */
(function(){
(function() {
'use strict';
var main = global.cloudcmd.main,
@ -39,10 +39,10 @@
* function listen on servers port
* @pServer {Object} started server object
*/
exports.listen = function(pServer){
exports.listen = function(pServer) {
var lRet, lListen, lConnNum, lMsg, lConn_func;
if(io){
if (io) {
lListen = io.listen(pServer),
lConnNum = 0;
@ -68,7 +68,7 @@
'jsonp-polling'
]);
lRet = lListen.sockets.on('connection', function (socket){
lRet = lListen.sockets.on('connection', function (socket) {
++lConnNum;
if(!OnMessageFuncs[lConnNum]) {
@ -92,7 +92,7 @@
return lRet;
};
function disconnect(pParams){
function disconnect(pParams) {
var lConnNum, lRet = Util.checkObj(pParams, ['params']);
if(lRet) {
@ -111,17 +111,17 @@
*
* @param pConnNum, pSocket
*/
function onMessage(pConnNum, pSocket){
function onMessage(pConnNum, pSocket) {
return function(pCommand) {
var lMsg, lJSON, lWinCommand, lExec_func, lDir,
lHome, lError, lRet;
Util.log('#' + pConnNum + ': ' + pCommand);
if( Util.isContainStrAtBegin(pCommand, CLOUDCMD) ) {
if (Util.isContainStrAtBegin(pCommand, CLOUDCMD)) {
pCommand = Util.removeStr(pCommand, CLOUDCMD);
if( Util.isContainStrAtBegin(pCommand, ' ') ){
if( Util.isContainStrAtBegin(pCommand, ' ') ) {
pCommand = Util.removeStr(pCommand, ' ');
if( Util.isContainStrAtBegin(pCommand, 'update') && update )
@ -153,7 +153,7 @@
if ( Util.isContainStr(lDir, '~') )
lDir = Util.replaceStr(lDir, '~', lHome);
lError = Util.tryCatchLog(function(){
lError = Util.tryCatchLog(function() {
process.chdir(lDir);
});
@ -175,7 +175,7 @@
* change code page to unicode becouse
* windows use unicode on non English versions
*/
if(WIN32){
if(WIN32) {
lWinCommand = pCommand.toUpperCase();
if( Win32Commands.indexOf(lWinCommand) >= 0 )
@ -197,7 +197,7 @@
* function send result of command to client
* @param pSocket
*/
function getExec(pSocket, pConnNum){
function getExec(pSocket, pConnNum) {
return function(pError, pStdout, pStderr) {
var lErrorStr, lExecStr, lExec,
lError = pStderr || pError;
@ -223,7 +223,7 @@
};
}
function log(pConnNum, pStr, pType){
function log(pConnNum, pStr, pType) {
var lRet, lType = ' ';
if (pStr) {