File tree Expand file tree Collapse file tree 1 file changed +5
-1
lines changed Expand file tree Collapse file tree 1 file changed +5
-1
lines changed Original file line number Diff line number Diff line change @@ -148,6 +148,9 @@ def read_ber_length
148
148
# implemented on the including object and that it returns a Fixnum value.
149
149
# Also requires #read(bytes) to work.
150
150
#
151
+ # Yields the object type `id` and the data `content_length` if a block is
152
+ # given. This is namely to support instrumentation.
153
+ #
151
154
# This does not work with non-blocking I/O.
152
155
def read_ber ( syntax = nil )
153
156
# TODO: clean this up so it works properly with partial packets coming
@@ -157,10 +160,11 @@ def read_ber(syntax = nil)
157
160
id = getbyte or return nil # don't trash this value, we'll use it later
158
161
content_length = read_ber_length
159
162
163
+ yield id , content_length if block_given?
164
+
160
165
if -1 == content_length
161
166
raise Net ::BER ::BerError , "Indeterminite BER content length not implemented."
162
167
else
163
- yield id , content_length if block_given?
164
168
data = read ( content_length )
165
169
end
166
170
You can’t perform that action at this time.
0 commit comments