Currently #close_cb is being used as general purpose callback for when something wrong happens and ssl session terminates. This "something wrong" are, from what I saw, standard SSL/TLS errors, and could be handled differently, in a more "ruby way".
My proposal would be: wrap those errors into exception objects (the equivalent to OpenSSL::SSL::SSLError, hopefully with better error messages). After that, one would have two options:
raise the exception (perform ssl session cleanups in an ensure block); remove the #close_cb need.
pass the exception to the #close_cb callback as argument, and let the user decide what to do with it.
Currently
#close_cb
is being used as general purpose callback for when something wrong happens and ssl session terminates. This "something wrong" are, from what I saw, standard SSL/TLS errors, and could be handled differently, in a more "ruby way".My proposal would be: wrap those errors into exception objects (the equivalent to
OpenSSL::SSL::SSLError
, hopefully with better error messages). After that, one would have two options:#close_cb
need.#close_cb
callback as argument, and let the user decide what to do with it.