limitations and irc to readme, version 0.1.2, socket debugging option, Notify exceptions support, better error logging, retry on socket error, dont expose external ip to websocket api, kill workers if no task, log time to console
This commit is contained in:
parent
185424b815
commit
b37e309eda
14 changed files with 136 additions and 68 deletions
|
@ -245,6 +245,7 @@ class UiRequest:
|
|||
|
||||
# Just raise an error to get console
|
||||
def actionConsole(self):
|
||||
sites = self.server.sites
|
||||
raise Exception("Here is your console")
|
||||
|
||||
|
||||
|
|
|
@ -6,6 +6,7 @@ from lib.geventwebsocket.handler import WebSocketHandler
|
|||
from Ui import UiRequest
|
||||
from Site import SiteManager
|
||||
from Config import config
|
||||
from Debug import Debug
|
||||
|
||||
# Skip websocket handler if not necessary
|
||||
class UiWSGIHandler(WSGIHandler):
|
||||
|
@ -48,19 +49,6 @@ class UiServer:
|
|||
return self.ui_request.route(path)
|
||||
|
||||
|
||||
# Send a message to all connected client
|
||||
def sendMessage(self, message):
|
||||
sent = 0
|
||||
for ws in self.websockets:
|
||||
try:
|
||||
ws.send(message)
|
||||
sent += 1
|
||||
except Exception, err:
|
||||
self.log.error("addMessage error: %s" % err)
|
||||
self.server.websockets.remove(ws)
|
||||
return sent
|
||||
|
||||
|
||||
# Reload the UiRequest class to prevent restarts in debug mode
|
||||
def reload(self):
|
||||
import imp
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import json, gevent, time, sys, hashlib
|
||||
from Config import config
|
||||
from Site import SiteManager
|
||||
from Debug import Debug
|
||||
|
||||
class UiWebsocket:
|
||||
def __init__(self, ws, site, server):
|
||||
|
@ -36,7 +37,7 @@ class UiWebsocket:
|
|||
if config.debug: # Allow websocket errors to appear on /Debug
|
||||
import sys
|
||||
sys.modules["src.main"].DebugHook.handleError()
|
||||
self.log.error("WebSocket error: %s" % err)
|
||||
self.log.error("WebSocket error: %s" % Debug.formatException(err))
|
||||
return "Bye."
|
||||
|
||||
|
||||
|
@ -70,7 +71,7 @@ class UiWebsocket:
|
|||
if cb: # Callback after client responsed
|
||||
self.waiting_cb[message["id"]] = cb
|
||||
except Exception, err:
|
||||
self.log.debug("Websocket send error: %s" % err)
|
||||
self.log.debug("Websocket send error: %s" % Debug.formatException(err))
|
||||
|
||||
|
||||
# Handle incoming messages
|
||||
|
@ -152,7 +153,7 @@ class UiWebsocket:
|
|||
# Server variables
|
||||
def actionServerInfo(self, to, params):
|
||||
ret = {
|
||||
"ip_external": config.ip_external,
|
||||
"ip_external": bool(config.ip_external),
|
||||
"platform": sys.platform,
|
||||
"fileserver_ip": config.fileserver_ip,
|
||||
"fileserver_port": config.fileserver_port,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue