ianbarber/TLSZMQ — pull request #3 by bertjwregeer (2013-04-04 16:47:19+00:00)
Title: Update TLSZmq::net_read()

I ran into a bug recently in my original code, which you grabbed from my site
(was kinda awesome to come across it!), I haven't had a chance to update the
blog post yet, but since I have been battling more of OpenSSL lately I did
document the issue:

https://gist.github.com/bertjwregeer/5300110#file-ssl_read-md

The basic gist of the matter is that SSL_read() will only process a single
record, at any point in time TLS/SSL allows the protocol to add multiple
"application data" records. Since SSL_read() will only process and read the
first record your actual reads may come up short, since more data may be
available. Unfortunately the only solution available is to loop on SSL_read()
until it returns 0, meaning it is done processing all of the records it can.

This fixes the issue.