#endif
)
{
+ GNUNET_break (0);
LOG (GNUNET_ERROR_TYPE_ERROR,
_
("Fatal internal logic error, process hangs in `%s' (abort with CTRL-C)!\n"),
"select");
- GNUNET_break (0);
}
#ifndef MINGW
tv.tv_sec = timeout.rel_value / GNUNET_TIME_UNIT_SECONDS.rel_value;
fh = (struct GNUNET_DISK_FileHandle *) GNUNET_CONTAINER_slist_get (&i,
NULL);
- if (fh->type == GNUNET_PIPE)
+ if (fh->type == GNUNET_DISK_HANLDE_TYPE_PIPE)
{
/* Read zero bytes to check the status of the pipe */
LOG (GNUNET_ERROR_TYPE_DEBUG, "Reading 0 bytes from the pipe 0x%x\n",
fh = (struct GNUNET_DISK_FileHandle *) GNUNET_CONTAINER_slist_get (&i,
NULL);
- if (fh->type == GNUNET_PIPE)
+ if (fh->type == GNUNET_DISK_HANLDE_TYPE_PIPE)
{
if (!PeekNamedPipe (fh->h, NULL, 0, NULL, &dwBytes, NULL))
{
LOG (GNUNET_ERROR_TYPE_DEBUG, "nfds: %d, handles: %d, will wait: %llu ms\n",
nfds, nhandles, (unsigned long long) ms_total);
if (nhandles)
+ {
returncode =
WaitForMultipleObjects (nhandles, handle_array, FALSE, ms_total);
- LOG (GNUNET_ERROR_TYPE_DEBUG, "WaitForMultipleObjects Returned : %d\n",
- returncode);
+ LOG (GNUNET_ERROR_TYPE_DEBUG, "WaitForMultipleObjects Returned : %d\n",
+ returncode);
+ }
+ else if (nfds > 0)
+ {
+ i = (int) WaitForSingleObject (select_finished_event, INFINITE);
+ returncode = WAIT_TIMEOUT;
+ }
+ else
+ {
+ /* Shouldn't come this far. If it does - investigate. */
+ GNUNET_assert (0);
+ }
if (nfds > 0)
{
i, readArray[i]->h, bret, waitstatus, error);
if (bret == 0)
{
- if (error != ERROR_BROKEN_PIPE)
+ /* TODO: either add more errors to this condition, or eliminate it
+ * entirely (failed to peek -> pipe is in serious trouble, should
+ * be selected as readable).
+ */
+ if (error != ERROR_BROKEN_PIPE && error != ERROR_INVALID_HANDLE)
continue;
}
else if (waitstatus <= 0)
fh = (struct GNUNET_DISK_FileHandle *) GNUNET_CONTAINER_slist_get (&t,
NULL);
- if (fh->type == GNUNET_PIPE)
+ if (fh->type == GNUNET_DISK_HANLDE_TYPE_PIPE)
{
CancelIo (fh->h);
}