Differences From Artifact [b3c7d0cf87]:
- File
src/OFStreamObserver.m
— part of check-in
[f4151a36e3]
at
2011-04-03 19:52:49
on branch trunk
— 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. (user: js, size: 10274) [annotate] [blame] [check-ins using]
To Artifact [c4fa7336ee]:
- File
src/OFStreamObserver.m
— part of check-in
[8349bc4bbe]
at
2011-04-04 23:32:10
on branch trunk
— Check the value of read/write in OFStreamObserver.
Some systems like Ubuntu have libc headers which specify an attribute
that the compiler should issue a warning if the return value is ignored. (user: js, size: 10328) [annotate] [blame] [check-ins using]
︙ | ︙ | |||
216 217 218 219 220 221 222 | OFNumber *qi = [OFNumber numberWithInt: QUEUE_ADD | QUEUE_READ]; @synchronized (queue) { [queue addObject: stream]; [queueInfo addObject: qi]; } | | | | | | 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 | OFNumber *qi = [OFNumber numberWithInt: QUEUE_ADD | QUEUE_READ]; @synchronized (queue) { [queue addObject: stream]; [queueInfo addObject: qi]; } assert(!write(cancelFd[1], "", 1)); [pool release]; } - (void)addStreamToObserveForWriting: (OFStream*)stream { OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init]; OFNumber *qi = [OFNumber numberWithInt: QUEUE_ADD | QUEUE_WRITE]; @synchronized (queue) { [queue addObject: stream]; [queueInfo addObject: qi]; } assert(!write(cancelFd[1], "", 1)); [pool release]; } - (void)removeStreamToObserveForReading: (OFStream*)stream { OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init]; OFNumber *qi = [OFNumber numberWithInt: QUEUE_REMOVE | QUEUE_READ]; @synchronized (queue) { [queue addObject: stream]; [queueInfo addObject: qi]; } assert(!write(cancelFd[1], "", 1)); [pool release]; } - (void)removeStreamToObserveForWriting: (OFStream*)stream { OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init]; OFNumber *qi = [OFNumber numberWithInt: QUEUE_REMOVE | QUEUE_WRITE]; @synchronized (queue) { [queue addObject: stream]; [queueInfo addObject: qi]; } assert(!write(cancelFd[1], "", 1)); [pool release]; } - (void)_processQueue { @synchronized (queue) { |
︙ | ︙ | |||
390 391 392 393 394 395 396 | OFNumber *num; OFStream *stream; if (fds_c[i].revents & POLLIN) { if (fds_c[i].fd == cancelFd[0]) { char buf; | | | 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 | OFNumber *num; OFStream *stream; if (fds_c[i].revents & POLLIN) { if (fds_c[i].fd == cancelFd[0]) { char buf; assert(!read(cancelFd[0], &buf, 1)); fds_c[i].revents = 0; continue; } num = [OFNumber numberWithInt: fds_c[i].fd]; stream = [fdToStream objectForKey: num]; |
︙ | ︙ | |||
435 436 437 438 439 440 441 | if (select(nfds, &readfds_, &writefds_, &exceptfds_, (timeout != -1 ? &tv : NULL)) < 1) return NO; if (FD_ISSET(cancelFd[0], &readfds_)) { char buf; | | | 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 | if (select(nfds, &readfds_, &writefds_, &exceptfds_, (timeout != -1 ? &tv : NULL)) < 1) return NO; if (FD_ISSET(cancelFd[0], &readfds_)) { char buf; assert(!read(cancelFd[0], &buf, 1)); } for (i = 0; i < count; i++) { int fd = [cArray[i] fileDescriptor]; if (FD_ISSET(fd, &readfds_)) { [delegate streamDidBecomeReadyForReading: cArray[i]]; |
︙ | ︙ |