Several users have reported handshake lockups with GnuTLS due to network problems or other issues, specifically bug#11143 and bug#10904. The attached patch adds a per-connection handshake counter and stops retrying if the counter hits 100. It logs both the retries (at level 5, so users won't see it normally) and the surrender at level 2. I think it's worth putting into 24.1 despite the code freeze. I think it's low-risk and potentially very good for the Emacs users. The fault for delaying the bug fix until now is entirely mine; sorry about that. Ted