예제 #1
0
파일: __init__.py 프로젝트: hekevintran/wdb
    def open(self, uuid):
        if self.request.headers['Origin'] != 'http://%s' % (
                self.request.headers['Host']):
            self.close()
            return

        self.uuid = uuid

        if isinstance(self.uuid, bytes):
            self.uuid = self.uuid.decode('utf-8')

        if self.uuid in websockets.uuids:
            log.warn(
                'Websocket already opened for %s. Closing previous one' %
                self.uuid)
            websockets.send(self.uuid, 'Die')
            websockets.close(uuid)

        if self.uuid not in sockets.uuids:
            log.warn(
                'Websocket opened for %s with no correponding socket' %
                self.uuid)
            sockets.send(self.uuid, 'Die')
            self.close()
            return

        log.info('Websocket opened for %s' % self.uuid)
        websockets.add(self.uuid, self)
예제 #2
0
파일: streams.py 프로젝트: clawplach/wdb
def on_close(stream, uuid):
    # None if the user closed the window
    log.info('uuid %s closed' % uuid)
    websockets.send(uuid, 'Die')
    websockets.close(uuid)
    websockets.remove(uuid)
    sockets.remove(uuid)
예제 #3
0
파일: __init__.py 프로젝트: Kozea/wdb
    def on_open(self, uuid):
        self.uuid = uuid

        if isinstance(self.uuid, bytes):
            self.uuid = self.uuid.decode('utf-8')

        if self.uuid in websockets.uuids:
            log.warn(
                'Websocket already opened for %s. Closing previous one' %
                self.uuid
            )
            websockets.send(self.uuid, 'Die')
            websockets.close(uuid)

        if self.uuid not in sockets.uuids:
            log.warn(
                'Websocket opened for %s with no correponding socket' %
                self.uuid
            )
            sockets.send(self.uuid, 'Die')
            self.close()
            return

        log.info('Websocket opened for %s' % self.uuid)
        websockets.add(self.uuid, self)
예제 #4
0
    def open(self, uuid):
        if self.request.headers['Origin'] != 'http://%s' % (
                self.request.headers['Host']):
            self.close()
            return

        self.uuid = uuid

        if isinstance(self.uuid, bytes):
            self.uuid = self.uuid.decode('utf-8')

        if self.uuid in websockets.uuids:
            log.warn('Websocket already opened for %s. Closing previous one' %
                     self.uuid)
            websockets.send(self.uuid, 'Die')
            websockets.close(uuid)

        if self.uuid not in sockets.uuids:
            log.warn('Websocket opened for %s with no correponding socket' %
                     self.uuid)
            sockets.send(self.uuid, 'Die')
            self.close()
            return

        log.info('Websocket opened for %s' % self.uuid)
        websockets.add(self.uuid, self)
예제 #5
0
def on_close(stream, uuid):
    # None if the user closed the window
    log.info('uuid %s closed' % uuid)
    websockets.send(uuid, 'Die')
    websockets.close(uuid)
    websockets.remove(uuid)
    sockets.remove(uuid)
예제 #6
0
파일: __init__.py 프로젝트: xx182/wdb
    def on_open(self, uuid):
        self.uuid = uuid

        if isinstance(self.uuid, bytes):
            self.uuid = self.uuid.decode('utf-8')

        if self.uuid in websockets.uuids:
            log.warn(
                'Websocket already opened for %s. Closing previous one' %
                self.uuid
            )
            websockets.send(self.uuid, 'Die')
            websockets.close(uuid)

        if self.uuid not in sockets.uuids:
            log.warn(
                'Websocket opened for %s with no correponding socket' %
                self.uuid
            )
            sockets.send(self.uuid, 'Die')
            self.close()
            return

        log.info('Websocket opened for %s' % self.uuid)
        websockets.add(self.uuid, self)
예제 #7
0
파일: streams.py 프로젝트: apriljdai/wdb
def on_close(stream, uuid):
    # None if the user closed the window
    log.info("uuid %s closed" % uuid)
    if websockets.get(uuid):
        websockets.send(uuid, "Die")
        websockets.close(uuid)
        websockets.remove(uuid)
    sockets.remove(uuid)
예제 #8
0
파일: streams.py 프로젝트: clawplach/wdb
def read_frame(stream, uuid, frame):
    if frame.decode('utf-8') == 'ServerBreaks':
        sockets.send(uuid, json.dumps(breakpoints.get()))
    else:
        websockets.send(uuid, frame)
    try:
        stream.read_bytes(4, partial(read_header, stream, uuid))
    except StreamClosedError:
        log.warn('Closed stream for %s' % uuid)
예제 #9
0
def read_frame(stream, uuid, frame):
    if frame.decode('utf-8') == 'ServerBreaks':
        sockets.send(uuid, json.dumps(breakpoints.get()))
    else:
        websockets.send(uuid, frame)
    try:
        stream.read_bytes(4, partial(read_header, stream, uuid))
    except StreamClosedError:
        log.warn('Closed stream for %s' % uuid)
예제 #10
0
파일: streams.py 프로젝트: apriljdai/wdb
def read_frame(stream, uuid, frame):
    decoded_frame = frame.decode("utf-8")
    if decoded_frame == "ServerBreaks":
        sockets.send(uuid, json.dumps(breakpoints.get()))
    elif decoded_frame == "PING":
        log.info("%s PONG" % uuid)
    else:
        websockets.send(uuid, frame)
    try:
        stream.read_bytes(4, partial(read_header, stream, uuid))
    except StreamClosedError:
        log.warn("Closed stream for %s" % uuid)
예제 #11
0
def read_frame(stream, uuid, frame):
    decoded_frame = frame.decode('utf-8')
    if decoded_frame == 'ServerBreaks':
        sockets.send(uuid, json.dumps(breakpoints.get()))
    elif decoded_frame == 'PING':
        log.info('%s PONG' % uuid)
    elif decoded_frame.startswith('UPDATE_FILENAME'):
        filename = decoded_frame.split('|', 1)[1]
        sockets.set_filename(uuid, filename)
    else:
        websockets.send(uuid, frame)
    try:
        stream.read_bytes(4, partial(read_header, stream, uuid))
    except StreamClosedError:
        log.warn('Closed stream for %s' % uuid)
예제 #12
0
def read_frame(stream, uuid, frame):
    decoded_frame = frame.decode('utf-8')
    if decoded_frame == 'ServerBreaks':
        sockets.send(uuid, json.dumps(breakpoints.get()))
    elif decoded_frame == 'PING':
        log.info('%s PONG' % uuid)
    elif decoded_frame.startswith('UPDATE_FILENAME'):
        filename = decoded_frame.split('|', 1)[1]
        sockets.set_filename(uuid, filename)
    else:
        websockets.send(uuid, frame)
    try:
        stream.read_bytes(4, partial(read_header, stream, uuid))
    except StreamClosedError:
        log.warn('Closed stream for %s' % uuid)