Anonymous | Login | 02-22-2019 10:22 UTC |
Main | My View | View Issues | Change Log | Docs |
Viewing Issue Simple Details [ Jump to Notes ] | [ View Advanced ] [ Issue History ] [ Print ] | ||||||||
ID | Category | Severity | Reproducibility | Date Submitted | Last Update | ||||
0007446 | [Squeak] Network | minor | always | 01-13-10 19:47 | 04-18-10 21:57 | ||||
Reporter | sig | View Status | public | ||||||
Assigned To | laza | ||||||||
Priority | normal | Resolution | fixed | ||||||
Status | closed | Product Version | trunk | ||||||
Summary | 0007446: [BUG][FIX] SocketStream>>peek | ||||||||
Description |
Peek should answer a next item to read , but do not advance the stream position. Therefore a following test should yield true: a := anyStream peek. b := anyStream next. self assert: (a = b). In a SocketStream, however , #next, first advances the lastRead ivar, then reads a next char answering inBuffer at: pos+1 ( where pos is the lastRead value before sending #next ) SocketStream>>next "Return next byte, if inBuffer is empty we recieve some more data and try again." self atEnd ifTrue: [^nil]. self isInBufferEmpty ifTrue: [self receiveData. self atEnd ifTrue: [^nil]]. lastRead := lastRead + 1. ^inBuffer at: lastRead But peek, answering a char from inBuffer at: pos !!! peek "Return next byte, if inBuffer is empty we recieve some more data and try again. Do not consume the byte." self atEnd ifTrue: [^nil]. self isInBufferEmpty ifTrue: [self receiveData. self atEnd ifTrue: [^nil]]. ^inBuffer at: lastRead The fix is: --- ^inBuffer at: lastRead +++ ^inBuffer at: lastRead+1 |
||||||||
Additional Information | |||||||||
Attached Files |
![]() |
||||||||
|
Mantis 1.0.8[^]
Copyright © 2000 - 2007 Mantis Group
52 total queries executed. 38 unique queries executed. |