ObjFW  Diff

Differences From Artifact [753eef6385]:

To Artifact [aece4ad798]:

  • File src/OFStreamObserver.h — part of check-in [535c2d5d9b] at 2011-09-19 16:22:23 on branch trunk — Make using -[tryReadLine] + OFStreamObserver safe.

    This makes it impossible for the developer to accidentally create a DoS.
    When data has been received after calling -[tryReadLine] and the string
    is still incomplete, -[streamIsReadyForReading:] will not be called
    anymore until new data has been received, thus preventing spinning in a
    loop. (user: js, size: 5199) [annotate] [blame] [check-ins using]


38
39
40
41
42
43
44







45
46
47
48
49
50
51
@protocol OFStreamObserverDelegate
#endif
#ifdef OF_HAVE_OPTIONAL_PROTOCOLS
@optional
#endif
/**
 * \brief This callback is called when a stream did get ready for reading.







 *
 * \param stream The stream which did become ready for reading
 */
- (void)streamIsReadyForReading: (OFStream*)stream;

/**
 * \brief This callback is called when a stream did get ready for writing.







>
>
>
>
>
>
>







38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
@protocol OFStreamObserverDelegate
#endif
#ifdef OF_HAVE_OPTIONAL_PROTOCOLS
@optional
#endif
/**
 * \brief This callback is called when a stream did get ready for reading.
 *
 * NOTE: When -[tryReadLine] or -[tryReadTillDelimiter:] has been called on the
 *	 the stream, this callback will not be called again until new data has
 *	 been received, even though there is still data in the cache. The reason
 *	 for this is to prevent spinning in a loop when there is an incomplete
 *	 string in the cache. Once the string is complete, the callback will be
 *	 called again if there is data in the cache.
 *
 * \param stream The stream which did become ready for reading
 */
- (void)streamIsReadyForReading: (OFStream*)stream;

/**
 * \brief This callback is called when a stream did get ready for writing.