Ported from localthings fork: bounded per-block retransmission (_BLOCK_MAX_ATTEMPTS/_BLOCK_ACK_TIMEOUT) instead of a single attempt per block, SZX renegotiation tracking, and a bugfix moving conn.send(datagram) inside the try that catches its own SSL errors.