ObjFW  Diff

Differences From Artifact [d4951ca160]:

To Artifact [79faaa634a]:


148
149
150
151
152
153
154
























155
156
157
158
159
160
161
			continue;
		}

		realEvents++;

		pool = objc_autoreleasePoolPush();

























		switch (eventList[i].filter) {
		case EVFILT_READ:
			if ([_delegate respondsToSelector:
			    @selector(objectIsReadyForReading:)])
				[_delegate objectIsReadyForReading:
				    _FDToObject[eventList[i].ident]];
			break;







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
			continue;
		}

		realEvents++;

		pool = objc_autoreleasePoolPush();

		/*
		 * If a file descriptor has been closed before it is removed
		 * from the kernel event observer, the file descriptor is not
		 * valid anymore and causes EBADF. As closing a file descriptor
		 * automatically removes it from the queue, there is nothing to
		 * do anymore.
		 *
		 * Ideally, a file descriptor should never be closed before it
		 * is removed from the kernel event observer, as in rare cases,
		 * it could result in removing the wrong object from the kernel
		 * event observer, for example if a file descriptor is closed,
		 * a new one created, added to the kernel event observer and
		 * then the old one removed, as the new one could now have the
		 * same file descriptor as the closed one had and thus the new
		 * one is removed.
		 *
		 * For other errors, call the callback like it was successful
		 * so that the read / write will generate an error and throw an
		 * exception.
		 */
		if ((eventList[i].flags & EV_ERROR) &&
		    eventList[i].data == EBADF)
			continue;

		switch (eventList[i].filter) {
		case EVFILT_READ:
			if ([_delegate respondsToSelector:
			    @selector(objectIsReadyForReading:)])
				[_delegate objectIsReadyForReading:
				    _FDToObject[eventList[i].ident]];
			break;