 ############################################################################
-# 
+#
 # sage.coffee -- TCP interface between NodeJS and a Sage server instance
 #
 # The TCP interface to the sage server is necessarily "weird" because

# Since control messages are much less frequent, this overhead is
# acceptable.
#
############################################################################ 

net     = require('net')


# code can't be trusted, e.g., anything in the server can be
# arbitrarily modified, all *control* messages, e.g., sending signals,
# cleaning up, etc. absolutely require making a separate TCP connection.
#
# So:
#
#    1. Make a connection to the TCP server, which runs as root and
#       forks on connection.
#
#    2. Create a new session, which drops privileges to a random clean
#       user, and continues to listen on the TCP socket when not doing
#       computations.
#
#    3. Send request-to-exec, etc., messages to the socket in (2)
#       and get back output over (2).
