Release 1.0-beta2
[FIX] Fixed /connect command [ADD] Added session counter (active/total) in /debug command
This commit is contained in:
parent
3189016dfa
commit
0625b5c3d4
|
@ -528,7 +528,7 @@ class TelegramClient
|
||||||
return path
|
return path
|
||||||
end
|
end
|
||||||
|
|
||||||
###########################################
|
# state functions #
|
||||||
def online?() @online end
|
def online?() @online end
|
||||||
def tz_set?() return @timezone != '-00:00' end
|
def tz_set?() return @timezone != '-00:00' end
|
||||||
end
|
end
|
||||||
|
|
|
@ -204,7 +204,7 @@ class XMPPComponent
|
||||||
when '/code', '/password' # pass auth data to telegram
|
when '/code', '/password' # pass auth data to telegram
|
||||||
@sessions[from.bare.to_s].process_auth(body.split[0], body.split[1]) if @sessions.key? from.bare.to_s
|
@sessions[from.bare.to_s].process_auth(body.split[0], body.split[1]) if @sessions.key? from.bare.to_s
|
||||||
when '/connect' # go online
|
when '/connect' # go online
|
||||||
@sessions[from.bare.to_s].client.connect() if @sessions.key? from.bare.to_s
|
@sessions[from.bare.to_s].connect() if @sessions.key? from.bare.to_s
|
||||||
when '/disconnect' # go offline (without destroying a session)
|
when '/disconnect' # go offline (without destroying a session)
|
||||||
@sessions[from.bare.to_s].disconnect() if @sessions.key? from.bare.to_s
|
@sessions[from.bare.to_s].disconnect() if @sessions.key? from.bare.to_s
|
||||||
when '/logout' # go offline and destroy session
|
when '/logout' # go offline and destroy session
|
||||||
|
@ -218,6 +218,7 @@ class XMPPComponent
|
||||||
Memprof2.report(out: dump) if dump
|
Memprof2.report(out: dump) if dump
|
||||||
response = "Debug information: \n\n"
|
response = "Debug information: \n\n"
|
||||||
response += "Running from: %s\n" % `ps -p #{$$} -o lstart`.lines.last.strip
|
response += "Running from: %s\n" % `ps -p #{$$} -o lstart`.lines.last.strip
|
||||||
|
response += "Sessions: %d online | %d total \n" % [ @sessions.inject(0){ |cnt, (jid, sess)| cnt = (sess.online?) ? cnt + 1 : cnt }, @sessions.count]
|
||||||
response += "System memory used: %d KB\n" % `ps -o rss -p #{$$}`.lines.last.strip.to_i
|
response += "System memory used: %d KB\n" % `ps -o rss -p #{$$}`.lines.last.strip.to_i
|
||||||
response += "Objects memory allocated: %d bytes \n" % `cut -d' ' -f1 #{dump}`.lines.map(&:to_i).reduce(0, :+) if dump
|
response += "Objects memory allocated: %d bytes \n" % `cut -d' ' -f1 #{dump}`.lines.map(&:to_i).reduce(0, :+) if dump
|
||||||
response += "\nDetailed memory info saved to %s\n" % dump if dump
|
response += "\nDetailed memory info saved to %s\n" % dump if dump
|
||||||
|
|
Reference in a new issue