Imported from archive.
[mudpy.git] / lib / muff / muffsock.py
index 67010b1..fe47061 100644 (file)
@@ -21,14 +21,13 @@ def check_for_connection(newsocket):
                return None
 
        # note that we got one
-       # TODO: we should log this crap somewhere
-       print "Connection from", address
+       muffmisc.log("Connection from " + address[0])
 
        # disable blocking so we can proceed whether or not we can send/receive
        connection.setblocking(0)
 
        # create a new user object
-       user = muffuser.User();
+       user = muffuser.User()
 
        # associate this connection with it
        user.connection = connection
@@ -51,7 +50,7 @@ def initialize_server_socket():
        newsocket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
 
        # bind the socket to to our desired server ipa and port
-       newsocket.bind((muffconf.config_data.get("network", "host"), muffconf.config_data.getint("network", "port")))
+       newsocket.bind((muffconf.get("network", "host"), muffconf.getint("network", "port")))
 
        # disable blocking so we can proceed whether or not we can send/receive
        newsocket.setblocking(0)
@@ -60,20 +59,8 @@ def initialize_server_socket():
        newsocket.listen(1)
 
        # note that we're now ready for user connections
-       # TODO: we should log this crap somewhere
-       print "Waiting for connection(s)..."
+       muffmisc.log("Waiting for connection(s)...")
 
        # store this in a globally-accessible place
        muffvars.newsocket = newsocket
 
-def destroy_all_sockets():
-       """Go through all connected users and close their sockets."""
-
-       # note that we're closing all sockets
-       # TODO: we should log this crap somewhere
-       print "Closing remaining connections..."
-
-       # iterate over each connected user and close their associated sockets
-       for user in muffvars.userlist:
-               user.connection.close()
-