server/lib/sync-protocol-handler.js
function checkFileSizeLimit(client, srcList) {
  function maxSizeExceeded(obj) {
    var errorMsg;

    client.lock.release(function(err) {
      if(err) {
        log.error({err: err, client: client}, 'Error releasing sync lock');
      }

      releaseLock(client);

      errorMsg = SyncMessage.error.maxsizeExceeded;
      errorMsg.content = {path: obj.path};
      client.sendMessage(errorMsg);
    });
  }

  for (var key in srcList) {
    if(srcList.hasOwnProperty(key)) {
      var obj = srcList[key];
      for (var prop in obj) {
        if(obj.hasOwnProperty(prop) && prop === 'size') {
          if(obj.size > MAX_SYNC_SIZE_BYTES) {
            // Fail this sync, contains a file that is too large.
            log.warn({client: client},
                     'Client tried to exceed file sync size limit: file was %s bytes, limit is %s',
                     obj.size, MAX_SYNC_SIZE_BYTES);
            maxSizeExceeded(obj);
            return false;
          }
        }
      }
    }
  }

  return true;
}
function checkFileSizeLimit(client, srcList) {
  function maxSizeExceeded(obj) {
    var errorMsg;

    client.lock.release(function(err) {
      if(err) {
        log.error({err: err, client: client}, 'Error releasing sync lock');
      }

      releaseLock(client);

      errorMsg = SyncMessage.error.maxsizeExceeded;
      errorMsg.content = {path: obj.path};
      client.sendMessage(errorMsg);
    });
  }

  for (var key in srcList) {
    if(srcList.hasOwnProperty(key)) {
      var obj = srcList[key];
      for (var prop in obj) {
        if(obj.hasOwnProperty(prop) && prop === 'size') {
          if(obj.size > MAX_SYNC_SIZE_BYTES) {
            // Fail this sync, contains a file that is too large.
            log.warn({client: client},
                     'Client tried to exceed file sync size limit: file was %s bytes, limit is %s',
                     obj.size, MAX_SYNC_SIZE_BYTES);
            maxSizeExceeded(obj);
            return false;
          }
        }
      }
    }
  }

  return true;
}
function checkFileSizeLimit ( client , srcList ) { function maxSizeExceeded ( obj ) { var errorMsg ; client . lock . release ( function ( err ) { if ( err ) { log . error ( { err : err , client : client } , 'Error releasing sync lock' ) ; } releaseLock ( client ) ; errorMsg = SyncMessage . error . maxsizeExceeded ; errorMsg . content = { path : obj . path } ; client . sendMessage ( errorMsg ) ; } ) ; } for ( var key in srcList ) { if ( srcList . hasOwnProperty ( key ) ) { var obj = srcList [ key ] ; for ( var prop in obj ) { if ( obj . hasOwnProperty ( prop ) && prop === 'size' ) { if ( obj . size > MAX_SYNC_SIZE_BYTES ) { // Fail this sync, contains a file that is too large. log . warn ( { client : client } , 'Client tried to exceed file sync size limit: file was %s bytes, limit is %s' , obj . size , MAX_SYNC_SIZE_BYTES ) ; maxSizeExceeded ( obj ) ; return false ; } } } } } return true ; }
Returns true if file sizes are all within limit, false if not. The client's lock is released, and an error sent to client in the false case.
Returns true if file sizes are all within limit false if not . The client s lock is released and an error sent to client in the false case .