aboutsummaryrefslogtreecommitdiffstats
path: root/lib/erl_interface/src/misc/ei_portio.c
AgeCommit message (Collapse)Author
2016-03-15update copyright-yearHenrik Nord
2015-06-18Change license text to APLv2Bruce Yinhe
2011-03-11Update copyright yearsBjörn-Egil Dahlberg
2010-10-29ei: check memory was allocatedMichael Santos
2010-09-11fix incorrect writev iovec buffer handling in eiSteve Vinoski
For platforms that support writev, ei uses iovec structures to be able to easily send noncontiguous data buffers. When sending large messages, the socket can of course block, in which case ei adjusts its iovecs to pick up where it left off when the socket becomes writeable again. Unfortunately the code that handled the case when the number of bytes written are less than the current iovec size adjusted only the iovec byte count but not the iovec data pointer, resulting in the same data being sent multiple times. The fix is trivial: in addition to subtracting the count of bytes already written from the current iovec's size, also increment the current iovec's data pointer by the number of bytes already written. Tested manually on Linux and verified to fix a problem detected in production with writing large binaries from a cnode to a regular node. No unit tests were added, however, because they use the local loopback which acts more like a pipe than an inter-host TCP connection. The closing of the TCP window on the receiving side and the resultant write blocking on the socket, which in turn caused the code that mishandled the iovecs to be exercised, could unfortunately not be readily duplicated in the erl_interface test suite.
2009-11-20The R13B03 release.OTP_R13B03Erlang/OTP