ObjFW  Check-in [f4151a36e3]

Overview
Comment:Add -[pendingBytes] to OFStream.

This way, the method to determine whether OFStreamSocket should
call the delegate can be overriden by subclasses, for example
for SSL sockets.

Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: f4151a36e30282849a3d0dd22a4899dd62be9f85f3c0bb48a4b4ab348860f975
User & Date: js on 2011-04-03 19:52:49
Other Links: manifest | tags
Context
2011-04-04
23:02
Indent -[description] of collections. check-in: 1df836eacc user: js tags: trunk
2011-04-03
19:52
Add -[pendingBytes] to OFStream. check-in: f4151a36e3 user: js tags: trunk
19:25
OPEN_MAX is not available on every system. check-in: 6d9854419c user: js tags: trunk
Changes

Modified src/OFStream.h from [24a5771adb] to [30f45428be].

325
326
327
328
329
330
331





332
333
334
335
336
337
338
 * \param fmt A string used as format
 * \param args The arguments used in the format string
 * \return The number of bytes written
 */
- (size_t)writeFormat: (OFString*)fmt
	withArguments: (va_list)args;






/**
 * \return Whether the stream is in blocking mode
 */
- (BOOL)isBlocking;

/**
 * Enables or disables non-blocking I/O.







>
>
>
>
>







325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
 * \param fmt A string used as format
 * \param args The arguments used in the format string
 * \return The number of bytes written
 */
- (size_t)writeFormat: (OFString*)fmt
	withArguments: (va_list)args;

/**
 * \return The number of bytes still present in the internal cache.
 */
- (size_t)pendingBytes;

/**
 * \return Whether the stream is in blocking mode
 */
- (BOOL)isBlocking;

/**
 * Enables or disables non-blocking I/O.

Modified src/OFStream.m from [d928d7a5b3] to [3989a671e1].

698
699
700
701
702
703
704





705
706
707
708
709
710
711
	} @finally {
		free(t);
	}

	/* Get rid of a warning, never reached anyway */
	assert(0);
}






- (BOOL)isBlocking
{
	return isBlocking;
}

- (void)setBlocking: (BOOL)enable







>
>
>
>
>







698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
	} @finally {
		free(t);
	}

	/* Get rid of a warning, never reached anyway */
	assert(0);
}

- (size_t)pendingBytes
{
	return cacheLen;
}

- (BOOL)isBlocking
{
	return isBlocking;
}

- (void)setBlocking: (BOOL)enable

Modified src/OFStreamObserver.m from [68c03424f8] to [b3c7d0cf87].

356
357
358
359
360
361
362
363
364
365
366
367
368
369
370

	[self _processQueue];

	cArray = [readStreams cArray];
	count = [readStreams count];

	for (i = 0; i < count; i++) {
		if (cArray[i]->cache != NULL) {
			[delegate streamDidBecomeReadyForReading: cArray[i]];
			foundInCache = YES;
			[pool releaseObjects];
		}
	}

	/*







|







356
357
358
359
360
361
362
363
364
365
366
367
368
369
370

	[self _processQueue];

	cArray = [readStreams cArray];
	count = [readStreams count];

	for (i = 0; i < count; i++) {
		if ([cArray[i] pendingBytes] > 0) {
			[delegate streamDidBecomeReadyForReading: cArray[i]];
			foundInCache = YES;
			[pool releaseObjects];
		}
	}

	/*