socks proxy support, disable udp connections support, http bittorrent tracker support, port opened, external ip to stats, only need zeroname site if dont have, dont try to download file that not in content.json, store external ip even if port closed, recreate uirequest class to avoid unfinished requests in some cases
This commit is contained in:
parent
b414a75885
commit
4f7e048413
36 changed files with 1927 additions and 80 deletions
|
@ -1,5 +1,6 @@
|
|||
import re, time, cgi, os
|
||||
from Plugin import PluginManager
|
||||
from Config import config
|
||||
|
||||
@PluginManager.registerTo("UiRequest")
|
||||
class UiRequestPlugin(object):
|
||||
|
@ -52,6 +53,8 @@ class UiRequestPlugin(object):
|
|||
|
||||
# Memory
|
||||
try:
|
||||
yield "Ip external: %s | " % config.ip_external
|
||||
yield "Port opened: %s | " % main.file_server.port_opened
|
||||
import psutil
|
||||
process = psutil.Process(os.getpid())
|
||||
mem = process.get_memory_info()[0] / float(2 ** 20)
|
||||
|
@ -59,21 +62,23 @@ class UiRequestPlugin(object):
|
|||
yield "Threads: %s | " % len(process.threads())
|
||||
yield "CPU: usr %.2fs sys %.2fs | " % process.cpu_times()
|
||||
yield "Open files: %s | " % len(process.open_files())
|
||||
yield "Sockets: %s" % len(process.connections())
|
||||
yield " | Calc size <a href='?size=1'>on</a> <a href='?size=0'>off</a><br>"
|
||||
yield "Sockets: %s | " % len(process.connections())
|
||||
yield "Calc size <a href='?size=1'>on</a> <a href='?size=0'>off</a>"
|
||||
except Exception, err:
|
||||
pass
|
||||
yield "<br>"
|
||||
|
||||
# Connections
|
||||
yield "<b>Connections</b> (%s):<br>" % len(main.file_server.connections)
|
||||
yield "<table><tr> <th>id</th> <th>protocol</th> <th>type</th> <th>ip</th> <th>ping</th> <th>buff</th>"
|
||||
yield "<table><tr> <th>id</th> <th>protocol</th> <th>type</th> <th>ip</th> <th>open</th> <th>ping</th> <th>buff</th>"
|
||||
yield "<th>idle</th> <th>open</th> <th>delay</th> <th>sent</th> <th>received</th> <th>last sent</th> <th>waiting</th> <th>version</th> <th>peerid</th> </tr>"
|
||||
for connection in main.file_server.connections:
|
||||
yield self.formatTableRow([
|
||||
("%3d", connection.id),
|
||||
("%s", connection.protocol),
|
||||
("%s", connection.type),
|
||||
("%s", connection.ip),
|
||||
("%s:%s", (connection.ip, connection.port)),
|
||||
("%s", connection.handshake.get("port_opened")),
|
||||
("%6.3f", connection.last_ping_delay),
|
||||
("%s", connection.incomplete_buff_recv),
|
||||
("since", max(connection.last_send_time, connection.last_recv_time)),
|
||||
|
@ -97,7 +102,7 @@ class UiRequestPlugin(object):
|
|||
yield self.formatTableRow([
|
||||
("%s", site.address),
|
||||
("%s", len(site.peers)),
|
||||
("%s", len([peer for peer in site.peers.values() if peer.connection and peer.connection.connected])),
|
||||
("%s/%s", ( len([peer for peer in site.peers.values() if peer.connection and peer.connection.connected]), len(site.peers) ) ),
|
||||
("%s", [peer.connection.id for peer in site.peers.values() if peer.connection and peer.connection.connected]),
|
||||
("%s", len(site.content_manager.contents)),
|
||||
])
|
||||
|
|
|
@ -15,7 +15,7 @@ class SiteManagerPlugin(object):
|
|||
site_zeroname = None
|
||||
def load(self):
|
||||
super(SiteManagerPlugin, self).load()
|
||||
self.need(self.zeroname_address) # Need ZeroName site
|
||||
if not self.get(self.zeroname_address): self.need(self.zeroname_address) # Need ZeroName site
|
||||
|
||||
# Checks if its a valid address
|
||||
def isAddress(self, address):
|
||||
|
|
|
@ -3,10 +3,10 @@ from Plugin import PluginManager
|
|||
|
||||
@PluginManager.registerTo("UiRequest")
|
||||
class UiRequestPlugin(object):
|
||||
def __init__(self, server = None):
|
||||
def __init__(self, *args, **kwargs):
|
||||
from Site import SiteManager
|
||||
self.site_manager = SiteManager.site_manager
|
||||
super(UiRequestPlugin, self).__init__(server)
|
||||
super(UiRequestPlugin, self).__init__(*args, **kwargs)
|
||||
|
||||
|
||||
# Media request
|
||||
|
|
|
@ -4,9 +4,9 @@ from Crypt import CryptBitcoin
|
|||
|
||||
@PluginManager.registerTo("UiRequest")
|
||||
class UiRequestPlugin(object):
|
||||
def __init__(self, server = None):
|
||||
def __init__(self, *args, **kwargs):
|
||||
self.user_manager = sys.modules["User.UserManager"].user_manager
|
||||
super(UiRequestPlugin, self).__init__(server)
|
||||
super(UiRequestPlugin, self).__init__(*args, **kwargs)
|
||||
|
||||
|
||||
# Create new user and inject user welcome message if necessary
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue