Mantis Bugtracker
  

Viewing Issue Simple Details Jump to Notes ] View Advanced ] Issue History ] Print ]
ID Category Severity Reproducibility Date Submitted Last Update
0006430 [Squeak] Network trivial always 04-18-07 20:33 04-19-07 07:32
Reporter dletz View Status public  
Assigned To cdegroot
Priority normal Resolution open  
Status assigned   Product Version 3.9
Summary 0006430: Socket>>sendStreamContents:checkBlock: uses wrong send loop
Description Hello Everyone,
 
when adding progress information to the FTPClient I found that this message has a Bug. It should call the "checkBlock" every 5000 thousand bytes - but does call it only once at the end of the file transfer.
To fix this i suggest replacing the two lines:
 
    [[stream atEnd and: [checkBlock value]]
        whileFalse: [
 
with:
 
    [[stream atEnd not and: [checkBlock value]]
        whileTrue: [
 
For reference I provide the full message code here:
 
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]
 
Additional Information Providing fix as changeset
Attached Files  Socket-sendStreamContentscheckBlock.st [^] (689 bytes) 04-18-07 20:33

- Relationships

- Notes
(0010581 - 25 - 25 - 25 - 25 - 25 - 25)
KenCausey
04-18-07 20:50

Set appropriate category.
 
(0010589 - 158 - 158 - 158 - 158 - 158 - 158)
gokr
04-19-07 07:32

Generally I would also recommend (I think) retrofitting ProtocolClient/FtpClient to use SocketStream instead of Socket directly - but that is a different day.
 

- Issue History
Date Modified Username Field Change
04-18-07 20:33 dletz New Issue
04-18-07 20:33 dletz Status new => assigned
04-18-07 20:33 dletz Assigned To  => KenCausey
04-18-07 20:33 dletz File Added: Socket-sendStreamContentscheckBlock.st
04-18-07 20:50 KenCausey Note Added: 0010581
04-18-07 20:50 KenCausey Assigned To KenCausey => cdegroot
04-18-07 20:50 KenCausey Category Any => Network
04-19-07 07:32 gokr Note Added: 0010589


Mantis 1.0.8[^]
Copyright © 2000 - 2007 Mantis Group
44 total queries executed.
34 unique queries executed.
Powered by Mantis Bugtracker