def monitor_tworld_status(self):
        
        if (self.tworldtimerbusy):
            self.log.warning('monitor_tworld_status: already in flight; did a previous call jam?')
            return

        if (self.tworldavailable):
            # Nothing to do
            return

        # We're going to hold this "lock" until the connection attempt
        # fails or definitely succeeds.
        self.tworldtimerbusy = True

        try:
            sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM, 0)
            # We do a sync connect, because I don't understand how the
            # async version works. (IOStream.connect seems to hang forever
            # when the other process is down?)
            sock.connect(('localhost', self.app.twopts.tworld_port))
            sock.setblocking(0)
            tornado.platform.auto.set_close_exec(sock.fileno())
            self.tworld = tornado.iostream.IOStream(sock)
            self.twbuffer = bytearray()
        except Exception as ex:
            self.log.error('Could not open tworld socket: %s', ex)
            self.tworldavailable = False
            self.tworldtimerbusy = False
            return
            
        self.log.info('Tworld socket open')

        # But it won't count as available until we get a response from it.
        try:
            arr = []
            for (connid, conn) in self.app.twconntable.as_dict().items():
                arr.append( { 'connid':connid, 'uid':str(conn.uid), 'email':conn.email } )
            self.tworld.write(wcproto.message(0, {'cmd':'connect', 'connections':arr}))
        except Exception as ex:
            self.log.error('Could not write connect message to tworld socket: %s', ex)
            self.tworld = None
            self.twbuffer = None
            self.tworldavailable = False
            self.tworldtimerbusy = False
            return
        
        self.tworld.read_until_close(self.close_tworld, self.read_tworld_data)
        # Exit, still holding tworldtimerbusy. We'll drop it if the connect
        # pong arrives, or if the socket closes.
Check the status of the Tworld connection. If the socket is
dataset/ETHPy150Open erkyrath/tworld/lib/tweblib/servers.py/ServerMgr.monitor_tworld_status