@@ -95,17 +95,13 @@ def self.wrap_with_ssl(io, tls_options = {}, timeout=nil)
9595 conn . connect
9696 end
9797 rescue IO ::WaitReadable
98- if IO . select ( [ conn ] , nil , nil , timeout )
99- retry
100- else
101- raise Errno ::ETIMEDOUT , "OpenSSL connection read timeout"
102- end
98+ raise Errno ::ETIMEDOUT , "OpenSSL connection read timeout" unless
99+ IO . select ( [ conn ] , nil , nil , timeout )
100+ retry
103101 rescue IO ::WaitWritable
104- if IO . select ( nil , [ conn ] , nil , timeout )
105- retry
106- else
107- raise Errno ::ETIMEDOUT , "OpenSSL connection write timeout"
108- end
102+ raise Errno ::ETIMEDOUT , "OpenSSL connection write timeout" unless
103+ IO . select ( nil , [ conn ] , nil , timeout )
104+ retry
109105 end
110106
111107 # Doesn't work:
@@ -163,11 +159,9 @@ def setup_encryption(args, timeout=nil)
163159 raise Net ::LDAP ::NoStartTLSResultError , "no start_tls result"
164160 end
165161
166- if pdu . result_code . zero?
167- @conn = self . class . wrap_with_ssl ( @conn , args [ :tls_options ] , timeout )
168- else
169- raise Net ::LDAP ::StartTLSError , "start_tls failed: #{ pdu . result_code } "
170- end
162+ raise Net ::LDAP ::StartTLSError ,
163+ "start_tls failed: #{ pdu . result_code } " unless pdu . result_code . zero?
164+ @conn = self . class . wrap_with_ssl ( @conn , args [ :tls_options ] , timeout )
171165 else
172166 raise Net ::LDAP ::EncMethodUnsupportedError , "unsupported encryption method #{ args [ :method ] } "
173167 end
@@ -197,12 +191,10 @@ def queued_read(message_id)
197191
198192 # read messages until we have a match for the given message_id
199193 while pdu = read
200- if pdu . message_id == message_id
201- return pdu
202- else
203- message_queue [ pdu . message_id ] . push pdu
204- next
205- end
194+ return pdu if pdu . message_id == message_id
195+
196+ message_queue [ pdu . message_id ] . push pdu
197+ next
206198 end
207199
208200 pdu
0 commit comments