         # e.g., users storing a multi-gigabyte worksheet title,
         # etc..., which would (and will) otherwise require care with
         # every single thing we store.
-        if data.length >= 50000000 # 5 MB
-            @push_to_client(message.error(error:"Messages are limited to 5MB.", id:mesg.id))
+        if data.length >= MESG_QUEUE_MAX_SIZE_MB * 10000000
+            @error_to_client(id:mesg.id, error:"Messages are limited to #{MESG_QUEUE_MAX_SIZE_MB}MB.")
 
         if data.length == 0
             winston.error("EMPTY DATA MESSAGE -- ignoring!")

                delete @_handle_data_queue_empty_function
                return

            # get task
            task = @_handle_data_queue.shift()
            # do task
            task[0](task[1])
            # do next one in >=50ms
            setTimeout( @_handle_data_queue_empty_function, 50 )

        @_handle_data_queue_empty_function()


SALVUS_HOME=process.cwd()

REQUIRE_ACCOUNT_TO_EXECUTE_CODE = false

# Anti DOS parameters:

# If a client sends a burst of messages, we space handling them out by this many milliseconds:.
MESG_QUEUE_INTERVAL_MS  = 50

# If a client sends a burst of messages, we discard all but the most recent this many of them:
MESG_QUEUE_MAX_COUNT    = 25

# Any messages larger than this is not allowed (it could take a long time to handle, etc.).
MESG_QUEUE_MAX_SIZE_MB  = 5

# node.js -- builtin libraries
net     = require 'net'
