You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# invalid BER length case. Because the "lengthlength" value was not used
137
137
# inside of #read_ber, we no longer return it.
138
138
defread_ber_length
139
-
n=getbyte_nonblock
139
+
n=ber_timeout_getbyte
140
140
141
141
ifn <= 0x7f
142
142
n
@@ -146,7 +146,7 @@ def read_ber_length
146
146
raiseNet::BER::BerError,"Invalid BER length 0xFF detected."
147
147
else
148
148
v=0
149
-
read_ber_nonblock(n & 0x7f).each_bytedo |b|
149
+
ber_timeout_read(n & 0x7f).each_bytedo |b|
150
150
v=(v << 8) + b
151
151
end
152
152
v
@@ -177,45 +177,126 @@ def read_ber(syntax = nil)
177
177
raiseNet::BER::BerError,
178
178
"Indeterminite BER content length not implemented."
179
179
end
180
-
data=read_ber_nonblock(content_length)
180
+
data=ber_timeout_read(content_length)
181
181
182
182
parse_ber_object(syntax,id,data)
183
183
end
184
184
185
185
# Internal: Returns the BER message ID or nil.
186
186
defread_ber_id
187
-
getbyte_nonblock
187
+
ber_timeout_getbyte
188
188
end
189
189
private:read_ber_id
190
190
191
+
# Internal: specify the BER socket read timeouts, nil by default (no timeout).
192
+
attr_accessor:ber_io_deadline
193
+
private:ber_io_deadline
194
+
195
+
##
196
+
# sets a timeout of timeout seconds for read_ber and ber_timeout_write operations in the provided block the proin the future for if there is not already a earlier deadline set
0 commit comments