mirror of
https://github.com/kawasaki/pyscrlink.git
synced 2025-09-06 09:40:14 +02:00
Compare commits
2 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
9265086b12 | ||
|
58a60c94db |
@@ -202,6 +202,10 @@ Please file issues to [GitHub issue tracker](https://github.com/kawasaki/pyscrli
|
|||||||
Releases
|
Releases
|
||||||
--------
|
--------
|
||||||
|
|
||||||
|
Release 0.2.3
|
||||||
|
|
||||||
|
* Fixed eternal loop caused by hostname resolve failure
|
||||||
|
|
||||||
Release 0.2.2
|
Release 0.2.2
|
||||||
|
|
||||||
* Supported multiple device connections for toio
|
* Supported multiple device connections for toio
|
||||||
|
@@ -8,6 +8,7 @@ import asyncio
|
|||||||
import pathlib
|
import pathlib
|
||||||
import ssl
|
import ssl
|
||||||
import websockets
|
import websockets
|
||||||
|
import socket
|
||||||
import json
|
import json
|
||||||
import base64
|
import base64
|
||||||
import logging
|
import logging
|
||||||
@@ -42,6 +43,8 @@ logger.setLevel(logLevel)
|
|||||||
logger.addHandler(handler)
|
logger.addHandler(handler)
|
||||||
logger.propagate = False
|
logger.propagate = False
|
||||||
|
|
||||||
|
HOSTNAME="device-manager.scratch.mit.edu"
|
||||||
|
|
||||||
class Session():
|
class Session():
|
||||||
"""Base class for BTSession and BLESession"""
|
"""Base class for BTSession and BLESession"""
|
||||||
def __init__(self, websocket, loop):
|
def __init__(self, websocket, loop):
|
||||||
@@ -738,7 +741,7 @@ def main():
|
|||||||
ssl_context.load_cert_chain(localhost_cer, localhost_key)
|
ssl_context.load_cert_chain(localhost_cer, localhost_key)
|
||||||
|
|
||||||
start_server = websockets.serve(
|
start_server = websockets.serve(
|
||||||
ws_handler, "device-manager.scratch.mit.edu", 20110, ssl=ssl_context
|
ws_handler, HOSTNAME, 20110, ssl=ssl_context
|
||||||
)
|
)
|
||||||
|
|
||||||
while True:
|
while True:
|
||||||
@@ -749,7 +752,13 @@ def main():
|
|||||||
except KeyboardInterrupt as e:
|
except KeyboardInterrupt as e:
|
||||||
stack_trace()
|
stack_trace()
|
||||||
break
|
break
|
||||||
|
except socket.gaierror as e:
|
||||||
|
logger.error(f"{type(e).__name__}: {e}")
|
||||||
|
logger.info(f"Check internet connection to {HOSTNAME}. If not "
|
||||||
|
f"available, add '127.0.0.1 {HOSTNAME}' to /etc/hosts.")
|
||||||
|
break
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
logger.error(f"{type(e).__name__}: {e}")
|
||||||
logger.info("Restarting scratch-link...")
|
logger.info("Restarting scratch-link...")
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
2
setup.py
2
setup.py
@@ -5,7 +5,7 @@ with open("README.md", "r") as fh:
|
|||||||
|
|
||||||
setuptools.setup(
|
setuptools.setup(
|
||||||
name="pyscrlink",
|
name="pyscrlink",
|
||||||
version="0.2.2",
|
version="0.2.3",
|
||||||
author="Shin'ichiro Kawasaki",
|
author="Shin'ichiro Kawasaki",
|
||||||
author_email='kawasaki@juno.dti.ne.jp',
|
author_email='kawasaki@juno.dti.ne.jp',
|
||||||
description='Scratch-link for Linux with Python',
|
description='Scratch-link for Linux with Python',
|
||||||
|
Reference in New Issue
Block a user