ASPLes / nopoll

OpenSource WebSocket toolkit
http://www.aspl.es/nopoll
GNU Lesser General Public License v2.1
126 stars 73 forks source link

Fix handling pending write data #16

Closed jcelaya closed 7 years ago

jcelaya commented 7 years ago

When SSL_write returns EAGAIN, it keeps a pointer to the data buffer that was being written. This buffer must exist the next time that SSL_write is called. So, this commit recycles the send_buffer in nopoll_conn_send_frame as pending_write, instead of creating a new buffer and copying so many data around.

Besides, nopoll_conn_send_frame correctly returns all the bytes as written, since they are kept in the pending_write buffer. Otherwise, the caller will try to write the same data again.

francisbrosnan commented 7 years ago

Thanks for the patch Javier. I've been checking it with regression tests and looks fine. Thanks for your time and effort, Best Regards,