smartware 0.4.6 → 0.4.7
Sign up to get free protection for your applications and to get access to all the features.
@@ -18,15 +18,22 @@ module Smartware
|
|
18
18
|
|
19
19
|
Logging.logger.debug "pppd: #{line}"
|
20
20
|
|
21
|
-
|
21
|
+
case line
|
22
|
+
when /authentication succeeded$/
|
23
|
+
@started = Time.now.to_i
|
24
|
+
|
25
|
+
when /^Sent ([0-9]+) bytes, received ([0-9]+) bytes.$/
|
22
26
|
@sent = $1.to_i
|
23
27
|
@received = $2.to_i
|
24
|
-
|
28
|
+
|
29
|
+
when /^Connect time ([0-9.]+) minutes.$/
|
25
30
|
@time = ($1.to_f * 60).round
|
26
|
-
|
31
|
+
|
32
|
+
when "Connection terminated."
|
27
33
|
begin
|
28
|
-
@device.account.call @sent, @received, @time
|
34
|
+
@device.account.call @started, @sent, @received, @time
|
29
35
|
ensure
|
36
|
+
@started = nil
|
30
37
|
@sent = nil
|
31
38
|
@received = nil
|
32
39
|
@time = nil
|
@@ -41,10 +41,10 @@ module Smartware
|
|
41
41
|
end
|
42
42
|
end
|
43
43
|
|
44
|
-
def account(sent, received, time)
|
44
|
+
def account(started, sent, received, time)
|
45
45
|
Smartware::Logging.logger.debug "recording session: #{sent} upstream #{received} downstream, #{time} seconds"
|
46
46
|
|
47
|
-
publish_reliable_event 'accounting', sent, received, time
|
47
|
+
publish_reliable_event 'accounting', started, sent, received, time
|
48
48
|
end
|
49
49
|
end
|
50
50
|
end
|
data/lib/smartware/version.rb
CHANGED