[Cuis-dev] [DEFECT] Socket>>#sendStreamContents:checkBlock: obviously broken

Juan Vuletich juan at cuis.st
Sun Sep 22 18:30:51 PDT 2024


I don't know.

Perhaphs check in Squeak? Or ask the author?

Thanks,

On 9/21/2024 10:07 AM, Gerald Klix via Cuis-dev wrote:
> Hi all, Hi Juan,
>
> Socket>>#sendStreamContents:checkBlock: does not make
> sure it really sent all bytes of each chuck it assumes it had sent.
>
> Admittedly I did not not test this, I was just locking at the code:
>
> sendStreamContents: stream checkBlock: checkBlock
>     "Send the data in the stream. Close the stream after you are     
> done. After each block of data evaluate checkBlock and abort if it 
> returns false.
>     Usefull for directly sending contents of a file without reading 
> into memory first."
>     [
>     | chunkSize buffer |
>     chunkSize := 5000.
>     buffer := ByteArray new: chunkSize.
>     stream binary.
>     [stream atEnd and: [checkBlock value]]
>         whileFalse: [
>             buffer := stream next: chunkSize into: buffer.
>             self sendData: buffer]]
>         ensure: [stream close]
>
> It sends #sendData: to itself, which in turn answers the
> number of bytes sent, which is not checked at all.
>
> Since this message is not send in any Cuis code or any
> other package I cloned form github, I suppose
> the easiest way to solve this issue is to just remove the method.
>
> NB: Chances are high that this method had worked at all on
> any interface with the exception of the look-back interface,
> because it uses a chunkSize (5000) bigger than the default MTU (1500).
>
>
> Best Regards,
>
> Gerald


-- 
Juan Vuletich
cuis.st
github.com/jvuletich
researchgate.net/profile/Juan-Vuletich
independent.academia.edu/JuanVuletich
patents.justia.com/inventor/juan-manuel-vuletich
linkedin.com/in/juan-vuletich-75611b3
twitter.com/JuanVuletich



More information about the Cuis-dev mailing list