fix incorrect writev iovec buffer handling in ei
fix incorrect writev iovec buffer handling in ei

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.

uabboli/otp,lantti/otp,lantti/otp,haguenau/otp,tuncer/otp,jemsbhai/otp,hairyhum/otp,jj1bdx/otp,RaimoNiskanen/otp,GinjaNinja32/otp,gjaldon/otp,benoitc/otp-1,release-project/otp,neeraj9/otp,ahmedshafeeq/otp,weisslj/otp,RGafiyatullin/otp,palas/otp,lantti/otp,rlipscombe/otp,mikpe/otp,paulcager/otp,paulcager/otp,RichMorin/otp,falkevik/otp,benoitc/otp-1,ferd/otp,vinoski/otp,RJ/otp,derek121/otp,g-andrade/otp,dgud/otp,bjorng/otp,johanclaesson/otp,c-rack/otp,msantos/otp,RaimoNiskanen/otp,enikki/otp,erlang/otp,lightcyphers/otp,lhslll/otp,jinshana/otp,isvilen/otp,dumbbell/otp,ahmedshafeeq/otp,lightcyphers/otp,getong/otp,c-rack/otp,isvilen/otp,bernardd/otp,saleyn/otp,benoitc/otp-1,johanclaesson/otp,electricimp/otp,aboroska/otp,legoscia/otp,schlagert/otp,RJ/otp,bjorng/otp,mujiatong/otp,johanclaesson/otp,vic/otp,lemenkov/otp,krishnakumar4a4/otp,massemanet/otp,vladdu/otp,paladim/otp,gjaldon/otp,dumbbell/otp,riverrun/otp,aboroska/otp,g-andrade/otp,palas/otp,goertzenator/otp,hairyhum/otp,mikpe/otp,bjorng/otp,entropiae/otp,lhslll/otp,vladdu/otp,palas/otp,ahmedshafeeq/otp,entropiae/otp,weisslj/otp,legoscia/otp,ferd/otp,marquisthunder/otp,falkevik/otp,entropiae/otp,sdebnath/otp,lucafavatella/otp,bsmr-erlang/otp,palas/otp,jinshana/otp,emile/otp,GinjaNinja32/otp,jj1bdx/otp,emacsmirror/erlang,electricimp/otp,kvakvs/otp,massemanet/otp,lantti/otp,derek121/otp,Teino1978-Corp/erlang-otp,getong/otp,neeraj9/otp,hairyhum/otp,msantos/otp,schlagert/otp,RGafiyatullin/otp,kvakvs/otp,erlang/otp,riverrun/otp,sitexa/otp,release-project/otp,hairyhum/otp,RichMorin/otp,bjorng/otp,mujiatong/otp,bernardd/otp,potatosalad/otp,lrascao/otp,electricimp/otp,schlagert/otp,cnbin/otp,cnbin/otp,beni55/otp,cobusc/otp,jj1bdx/otp,Teino1978-Corp/erlang-otp,RoadRunnr/otp,marquisthunder/otp,legoscia/otp,RichMorin/otp,RaimoNiskanen/otp,riverrun/otp,rlipscombe/otp,uabboli/otp,Teino1978-Corp/erlang-otp,lemenkov/otp,basho/otp,RichMorin/otp,kvakvs/otp,klarna/otp,sitexa/otp,isvilen/otp,mikpe/otp,ahmedshafeeq/otp,cobusc/otp,release-project/otp,RichMorin/otp,aboroska/otp,schlagert/otp,emile/otp,isvilen/otp,yangchengjian/otp,jemsbhai/otp,mikpe/otp,jinshana/otp,vic/otp,yangchengjian/otp,uabboli/otp,bernardd/otp,lianghaivv/otp,matwey/otp,sammoth-wazoku/otp,msantos/otp,getong/otp,palas/otp,jinshana/otp,weisslj/otp,legoscia/otp,psyeugenic/otp,RoadRunnr/otp,paulcager/otp,fenollp/otp,theom/otp,weisslj/otp,g-andrade/otp,psyeugenic/otp,matwey/otp,kvakvs/otp,fenollp/otp,tuncer/otp,basho/otp,sammoth-wazoku/otp,NOMORECOFFEE/otp,paladim/otp,vinoski/otp,gjaldon/otp,ferd/otp,falkevik/otp,c-rack/otp,krishnakumar4a4/otp,gjaldon/otp,riverrun/otp,jemsbhai/otp,potatosalad/otp,saleyn/otp,sdebnath/otp,theom/otp,lemenkov/otp,goertzenator/otp,basho/otp,weisslj/otp,vladdu/otp,dgud/otp,awetzel/otp,beni55/otp,massemanet/otp,uabboli/otp,RGafiyatullin/otp,jamesruan/otp,VincentHHL/otp,vic/otp,tuncer/otp,emacsmirror/erlang,RoadRunnr/otp,RGafiyatullin/otp,goertzenator/otp,aboroska/otp,GinjaNinja32/otp,goertzenator/otp,derek121/otp,jemsbhai/otp,RGafiyatullin/otp,dumbbell/otp,falkevik/otp,lantti/otp,enikki/otp,rlipscombe/otp,bugs-erlang-org/otp,vic/otp,dumbbell/otp,lucafavatella/otp,potatosalad/otp,emacsmirror/erlang,RoadRunnr/otp,ferd/otp,sammoth-wazoku/otp,msantos/otp,GinjaNinja32/otp,falkevik/otp,g-andrade/otp,mujiatong/otp,fenollp/otp,platinumthinker/otp,mikpe/otp,vladdu/otp,weisslj/otp,RoadRunnr/otp,VincentHHL/otp,jemsbhai/otp,lemenkov/otp,bugs-erlang-org/otp,bugs-erlang-org/otp,enikki/otp,marquisthunder/otp,platinumthinker/otp,VincentHHL/otp,lightcyphers/otp,krishnakumar4a4/otp,RaimoNiskanen/otp,bsmr-erlang/otp,massemanet/otp,vinoski/otp,basho/otp,ferd/otp,schlagert/otp,aboroska/otp,goertzenator/otp,jj1bdx/otp,derek121/otp,release-project/otp,enikki/otp,awetzel/otp,lianghaivv/otp,lrascao/otp,bernardd/otp,basho/otp,mujiatong/otp,yangchengjian/otp,haguenau/otp,VincentHHL/otp,electricimp/otp,jamesruan/otp,vladdu/otp,theom/otp,lemenkov/otp,fenollp/otp,fenollp/otp,sdebnath/otp,NOMORECOFFEE/otp,benoitc/otp-1,massemanet/otp,emacsmirror/erlang,lightcyphers/otp,derek121/otp,entropiae/otp,fenollp/otp,palas/otp,krishnakumar4a4/otp,isvilen/otp,mujiatong/otp,sitexa/otp,matwey/otp,g-andrade/otp,vinoski/otp,matwey/otp,ahmedshafeeq/otp,riverrun/otp,ader1990/otp,dgud/otp,release-project/otp,sdebnath/otp,stolen/otp,paulcager/otp,yangchengjian/otp,vinoski/otp,release-project/otp,bsmr-erlang/otp,neeraj9/otp,bsmr-erlang/otp,electricimp/otp,ferd/otp,c-rack/otp,jamesruan/otp,entropiae/otp,erlang/otp,derek121/otp,platinumthinker/otp,VincentHHL/otp,marquisthunder/otp,entropiae/otp,gjaldon/otp,rlipscombe/otp,aboroska/otp,massemanet/otp,tuncer/otp,klarna/otp,rlipscombe/otp,ader1990/otp,rlipscombe/otp,vic/otp,johanclaesson/otp,klarna/otp,stolen/otp,getong/otp,lucafavatella/otp,lhslll/otp,ferd/otp,krishnakumar4a4/otp,cobusc/otp,ahmedshafeeq/otp,cobusc/otp,stolen/otp,emacsmirror/erlang,lightcyphers/otp,jj1bdx/otp,lianghaivv/otp,beni55/otp,lightcyphers/otp,riverrun/otp,sitexa/otp,beni55/otp,VincentHHL/otp,matwey/otp,stolen/otp,saleyn/otp,bsmr-erlang/otp,g-andrade/otp,lhslll/otp,isvilen/otp,paladim/otp,jj1bdx/otp,jinshana/otp,c-rack/otp,tuncer/otp,Teino1978-Corp/otp,bjorng/otp,schlagert/otp,matwey/otp,kvakvs/otp,vinoski/otp,getong/otp,dgud/otp,awetzel/otp,RichMorin/otp,RGafiyatullin/otp,krishnakumar4a4/otp,dgud/otp,derek121/otp,vic/otp,lucafavatella/otp,bernardd/otp,lucafavatella/otp,psyeugenic/otp,emacsmirror/erlang,lianghaivv/otp,ader1990/otp,lianghaivv/otp,mujiatong/otp,erlang/otp,kvakvs/otp,lrascao/otp,mujiatong/otp,entropiae/otp,stolen/otp,Teino1978-Corp/otp,bernardd/otp,Teino1978-Corp/erlang-otp,vic/otp,sitexa/otp,cnbin/otp,matwey/otp,lrascao/otp,paulcager/otp,emile/otp,tuncer/otp,paulcager/otp,lucafavatella/otp,release-project/otp,klarna/otp,derek121/otp,Teino1978-Corp/erlang-otp,ader1990/otp,dumbbell/otp,vic/otp,lianghaivv/otp,vinoski/otp,sammoth-wazoku/otp,falkevik/otp,dgud/otp,basho/otp,RJ/otp,haguenau/otp,c-rack/otp,cobusc/otp,NOMORECOFFEE/otp,RoadRunnr/otp,lucafavatella/otp,neeraj9/otp,krishnakumar4a4/otp,schlagert/otp,Teino1978-Corp/otp,emile/otp,falkevik/otp,mikpe/otp,vinoski/otp,awetzel/otp,beni55/otp,erlang/otp,msantos/otp,electricimp/otp,paulcager/otp,bugs-erlang-org/otp,emile/otp,jinshana/otp,potatosalad/otp,lianghaivv/otp,theom/otp,cnbin/otp,basho/otp,erlang/otp,saleyn/otp,release-project/otp,bjorng/otp,RichMorin/otp,basho/otp,gjaldon/otp,fenollp/otp,mikpe/otp,lhslll/otp,sdebnath/otp,lhslll/otp,dgud/otp,sdebnath/otp,lrascao/otp,emacsmirror/erlang,NOMORECOFFEE/otp,beni55/otp,jj1bdx/otp,sdebnath/otp,goertzenator/otp,awetzel/otp,paladim/otp,NOMORECOFFEE/otp,potatosalad/otp,beni55/otp,massemanet/otp,rlipscombe/otp,theom/otp,electricimp/otp,g-andrade/otp,NOMORECOFFEE/otp,matwey/otp,GinjaNinja32/otp,enikki/otp,krishnakumar4a4/otp,neeraj9/otp,isvilen/otp,erlang/otp,RoadRunnr/otp,potatosalad/otp,dumbbell/otp,ahmedshafeeq/otp,ader1990/otp,enikki/otp,cnbin/otp,stolen/otp,dumbbell/otp,palas/otp,enikki/otp,potatosalad/otp,yangchengjian/otp,bsmr-erlang/otp,jamesruan/otp,lrascao/otp,benoitc/otp-1,lantti/otp,emile/otp,Teino1978-Corp/otp,NOMORECOFFEE/otp,RoadRunnr/otp,matwey/otp,cobusc/otp,saleyn/otp,haguenau/otp,msantos/otp,klarna/otp,bjorng/otp,jemsbhai/otp,GinjaNinja32/otp,legoscia/otp,psyeugenic/otp,tuncer/otp,kvakvs/otp,bjorng/otp,sammoth-wazoku/otp,RJ/otp,lemenkov/otp,mikpe/otp,isvilen/otp,erlang/otp,cobusc/otp,msantos/otp,jemsbhai/otp,jj1bdx/otp,mikpe/otp,dumbbell/otp,paladim/otp,lrascao/otp,tuncer/otp,VincentHHL/otp,palas/otp,sitexa/otp,neeraj9/otp,legoscia/otp,neeraj9/otp,rlipscombe/otp,uabboli/otp,bjorng/otp,ader1990/otp,vladdu/otp,marquisthunder/otp,yangchengjian/otp,jamesruan/otp,uabboli/otp,RaimoNiskanen/otp,RJ/otp,RaimoNiskanen/otp,sitexa/otp,lhslll/otp,g-andrade/otp,Teino1978-Corp/otp,Teino1978-Corp/erlang-otp,RGafiyatullin/otp,aboroska/otp,bernardd/otp,enikki/otp,hairyhum/otp,cnbin/otp,sammoth-wazoku/otp,awetzel/otp,RaimoNiskanen/otp,benoitc/otp-1,emile/otp,ader1990/otp,awetzel/otp,ferd/otp,potatosalad/otp,vladdu/otp,theom/otp,vladdu/otp,ahmedshafeeq/otp,erlang/otp,neeraj9/otp,ahmedshafeeq/otp,platinumthinker/otp,rlipscombe/otp,haguenau/otp,legoscia/otp,getong/otp,RichMorin/otp,bernardd/otp,hairyhum/otp,emacsmirror/erlang,VincentHHL/otp,lightcyphers/otp,uabboli/otp,goertzenator/otp,ader1990/otp,falkevik/otp,goertzenator/otp,GinjaNinja32/otp,msantos/otp,lemenkov/otp,klarna/otp,bjorng/otp,hairyhum/otp,RaimoNiskanen/otp,paladim/otp,RaimoNiskanen/otp,cnbin/otp,gjaldon/otp,emile/otp,theom/otp,RJ/otp,vladdu/otp,erlang/otp,haguenau/otp,isvilen/otp,marquisthunder/otp,rlipscombe/otp,entropiae/otp,mikpe/otp,Teino1978-Corp/otp,RJ/otp,gjaldon/otp,sammoth-wazoku/otp,paladim/otp,hairyhum/otp,c-rack/otp,basho/otp,beni55/otp,marquisthunder/otp,lightcyphers/otp,bugs-erlang-org/otp,Teino1978-Corp/erlang-otp,emacsmirror/erlang,vinoski/otp,stolen/otp,GinjaNinja32/otp,cobusc/otp,potatosalad/otp,paulcager/otp,c-rack/otp,uabboli/otp,saleyn/otp,dumbbell/otp,dumbbell/otp,jamesruan/otp,sitexa/otp,sdebnath/otp,getong/otp,lhslll/otp,dgud/otp,getong/otp,riverrun/otp,lrascao/otp,lrascao/otp,platinumthinker/otp,platinumthinker/otp,lemenkov/otp,saleyn/otp,massemanet/otp,johanclaesson/otp,RJ/otp,benoitc/otp-1,theom/otp,jinshana/otp,yangchengjian/otp,kvakvs/otp,aboroska/otp,g-andrade/otp,bernardd/otp,lantti/otp,ferd/otp,riverrun/otp,bugs-erlang-org/otp,johanclaesson/otp,benoitc/otp-1,emile/otp,emacsmirror/erlang,cnbin/otp,jemsbhai/otp,weisslj/otp,getong/otp,legoscia/otp,NOMORECOFFEE/otp,sammoth-wazoku/otp,jj1bdx/otp,uabboli/otp,jj1bdx/otp,dgud/otp,bsmr-erlang/otp,psyeugenic/otp,marquisthunder/otp,electricimp/otp,RoadRunnr/otp,paladim/otp,Teino1978-Corp/erlang-otp,lianghaivv/otp,bugs-erlang-org/otp,saleyn/otp,vinoski/otp,massemanet/otp,RGafiyatullin/otp,saleyn/otp,bugs-erlang-org/otp,platinumthinker/otp,Teino1978-Corp/otp,jamesruan/otp,electricimp/otp,jinshana/otp,fenollp/otp,platinumthinker/otp,kvakvs/otp,aboroska/otp,lantti/otp,g-andrade/otp,bsmr-erlang/otp,weisslj/otp,falkevik/otp,jamesruan/otp,psyeugenic/otp,legoscia/otp,schlagert/otp,stolen/otp,haguenau/otp,klarna/otp,psyeugenic/otp,weisslj/otp,klarna/otp,goertzenator/otp,dgud/otp,release-project/otp,johanclaesson/otp,yangchengjian/otp,Teino1978-Corp/otp,lucafavatella/otp,mujiatong/otp,psyeugenic/otp,isvilen/otp,fenollp/otp,johanclaesson/otp,potatosalad/otp,bsmr-erlang/otp,awetzel/otp,tuncer/otp,haguenau/otp,getong/otp