connection.setblocking(0)
# create a new user object
- user = muffuser.User();
+ user = muffuser.User()
# associate this connection with it
user.connection = connection
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)
# 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
- muffmisc.log("Closing remaining connections...")
-
- # iterate over each connected user and close their associated sockets
- for user in muffvars.userlist:
- user.connection.close()
-