DIY-pcap 0.3.4 → 0.3.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -110,7 +110,11 @@ module DIY
110
110
 
111
111
  def stats_result( cost_time, fail_count )
112
112
  DIY::Logger.info " ====== Finished in #{cost_time} seconds"
113
- DIY::Logger.info " ====== Total fail_count: #{fail_count} failures"
113
+ DIY::Logger.info " ====== #{offline_result}, #{fail_count} failures"
114
+ end
115
+
116
+ def offline_result
117
+ sprintf "%4d files, %8d packets", @offline.files_size, @offline.now_size
114
118
  end
115
119
 
116
120
  def wait_recv_ok(pkts)
@@ -126,7 +130,7 @@ module DIY
126
130
  Timeout.timeout(timeout, DIY::HopePacketTimeoutError.new("hope packet wait timeout after #{timeout} seconds") ) do
127
131
  loop do
128
132
  break if block.call
129
- sleep 0.1
133
+ sleep 0.01
130
134
  end
131
135
  end
132
136
  end
@@ -88,7 +88,6 @@ module DIY
88
88
  DIY::Logger.info("pcap file changed: #{@pcap_files[@position]} ( #{@position} of #{@pcap_files.size} )")
89
89
  @off = FFI::PCap::Offline.new(@pcap_files[@position])
90
90
  @num = 0
91
- clear_cached_mac
92
91
  fetch_cache
93
92
  end
94
93
 
@@ -100,5 +99,13 @@ module DIY
100
99
  "pkt: `#{filename}: #{@num}th' "
101
100
  end
102
101
 
102
+ def now_size
103
+ @num
104
+ end
105
+
106
+ def files_size
107
+ @pcap_files.size
108
+ end
109
+
103
110
  end
104
111
  end
@@ -17,8 +17,8 @@ module DIY
17
17
  new_pkt = pkt.dup
18
18
  Mu::Pcap::Ethernet.from_bytes(new_pkt).to_s + size_print_str
19
19
  rescue Mu::Pcap::ParseError =>e
20
- DIY::Logger.warn "parse error from pkt: " + ( pkt[0..10] + "..." ).dump + size_print_str
21
- return ( pkt[0..10] + "..." ).dump + size_print_str
20
+ DIY::Logger.debug "parse error from pkt: " + ( pkt[0..10] + "..." ).dump + size_print_str
21
+ return ( pkt[0..10] + "..." ).dump + size_print_str + "( parse failed )"
22
22
  end
23
23
  end
24
24
 
@@ -1,5 +1,5 @@
1
1
  module DIY
2
2
  class PCAP
3
- VERSION = "0.3.4"
3
+ VERSION = "0.3.5"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,12 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: DIY-pcap
3
3
  version: !ruby/object:Gem::Version
4
- prerelease: false
4
+ hash: 25
5
+ prerelease:
5
6
  segments:
6
7
  - 0
7
8
  - 3
8
- - 4
9
- version: 0.3.4
9
+ - 5
10
+ version: 0.3.5
10
11
  platform: ruby
11
12
  authors:
12
13
  - yafei Lee
@@ -14,8 +15,7 @@ autorequire:
14
15
  bindir: bin
15
16
  cert_chain: []
16
17
 
17
- date: 2012-10-15 00:00:00 +08:00
18
- default_executable:
18
+ date: 2012-10-15 00:00:00 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  name: ffi-pcap
@@ -25,6 +25,7 @@ dependencies:
25
25
  requirements:
26
26
  - - ">="
27
27
  - !ruby/object:Gem::Version
28
+ hash: 23
28
29
  segments:
29
30
  - 0
30
31
  - 2
@@ -147,7 +148,6 @@ files:
147
148
  - spec/spec_helper.rb
148
149
  - spec/utils_spec.rb
149
150
  - spec/worker_spec.rb
150
- has_rdoc: true
151
151
  homepage: ""
152
152
  licenses: []
153
153
 
@@ -161,6 +161,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
161
161
  requirements:
162
162
  - - ">="
163
163
  - !ruby/object:Gem::Version
164
+ hash: 3
164
165
  segments:
165
166
  - 0
166
167
  version: "0"
@@ -169,13 +170,14 @@ required_rubygems_version: !ruby/object:Gem::Requirement
169
170
  requirements:
170
171
  - - ">="
171
172
  - !ruby/object:Gem::Version
173
+ hash: 3
172
174
  segments:
173
175
  - 0
174
176
  version: "0"
175
177
  requirements: []
176
178
 
177
179
  rubyforge_project:
178
- rubygems_version: 1.3.7
180
+ rubygems_version: 1.8.24
179
181
  signing_key:
180
182
  specification_version: 3
181
183
  summary: DIY pcap send and recv