ObjFW  Diff

Differences From 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]

To Artifact [b87bb931e4]:


23
24
25
26
27
28
29


30
31
32
33
34
35
36
# include <windows.h>
# include <ws2tcpip.h>
#endif

@class OFStream;
@class OFMutableArray;
@class OFMutableDictionary;



/**
 * \brief A protocol that needs to be implemented by delegates for
 *	  OFStreamObserver.
 */
#ifndef OF_STREAM_OBSERVER_M
@protocol OFStreamObserverDelegate <OFObject>







>
>







23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# include <windows.h>
# include <ws2tcpip.h>
#endif

@class OFStream;
@class OFMutableArray;
@class OFMutableDictionary;
@class OFDataArray;
@class OFMutex;

/**
 * \brief A protocol that needs to be implemented by delegates for
 *	  OFStreamObserver.
 */
#ifndef OF_STREAM_OBSERVER_M
@protocol OFStreamObserverDelegate <OFObject>
76
77
78
79
80
81
82
83

84
85
86
87
88

89
90
91
92
93
94
95
 */
@interface OFStreamObserver: OFObject
{
	OFMutableArray *readStreams;
	OFMutableArray *writeStreams;
	OFStream **FDToStream;
	size_t maxFD;
	OFMutableArray *queue, *queueInfo;

	id <OFStreamObserverDelegate> delegate;
	int cancelFD[2];
#ifdef _WIN32
	struct sockaddr_in cancelAddr;
#endif

}

#ifdef OF_HAVE_PROPERTIES
@property (retain) id <OFStreamObserverDelegate> delegate;
#endif

/**







|
>





>







78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
 */
@interface OFStreamObserver: OFObject
{
	OFMutableArray *readStreams;
	OFMutableArray *writeStreams;
	OFStream **FDToStream;
	size_t maxFD;
	OFMutableArray *queue;
	OFDataArray *queueInfo, *queueFDs;
	id <OFStreamObserverDelegate> delegate;
	int cancelFD[2];
#ifdef _WIN32
	struct sockaddr_in cancelAddr;
#endif
	OFMutex *mutex;
}

#ifdef OF_HAVE_PROPERTIES
@property (retain) id <OFStreamObserverDelegate> delegate;
#endif

/**