diff options
author | Christian Grothoff <christian@grothoff.org> | 2011-08-15 12:45:54 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2011-08-15 12:45:54 +0000 |
commit | 22b4ebf9d7bba7176baf9e426c953cc7276aa15a (patch) | |
tree | 6a380573b399d9dfd488ebcba0455a566be8020f | |
parent | e1f5c1726ef0037dd836c68266fe8a4e88f196ca (diff) | |
download | gnunet-gtk-22b4ebf9d7bba7176baf9e426c953cc7276aa15a.tar.gz gnunet-gtk-22b4ebf9d7bba7176baf9e426c953cc7276aa15a.zip |
some code cleanup
-rw-r--r-- | src/lib/eventloop.c | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/src/lib/eventloop.c b/src/lib/eventloop.c index 507ce315..82168e3a 100644 --- a/src/lib/eventloop.c +++ b/src/lib/eventloop.c | |||
@@ -367,8 +367,7 @@ gnunet_gtk_select (void *cls, | |||
367 | GNUNET_CONTAINER_slist_end (t) != GNUNET_YES; | 367 | GNUNET_CONTAINER_slist_end (t) != GNUNET_YES; |
368 | GNUNET_CONTAINER_slist_next (t), i += 1) | 368 | GNUNET_CONTAINER_slist_next (t), i += 1) |
369 | { | 369 | { |
370 | struct GNUNET_DISK_FileHandle *fh; | 370 | struct GNUNET_DISK_FileHandle *fh = GNUNET_CONTAINER_slist_get (t, NULL); |
371 | fh = (struct GNUNET_DISK_FileHandle *) GNUNET_CONTAINER_slist_get (t, NULL); | ||
372 | if (fh->type == GNUNET_PIPE) | 371 | if (fh->type == GNUNET_PIPE) |
373 | { | 372 | { |
374 | if (!ReadFile (fh->h, NULL, 0, NULL, fh->oOverlapRead)) | 373 | if (!ReadFile (fh->h, NULL, 0, NULL, fh->oOverlapRead)) |
@@ -436,9 +435,9 @@ gnunet_gtk_select (void *cls, | |||
436 | GNUNET_CONTAINER_slist_end (t) != GNUNET_YES; | 435 | GNUNET_CONTAINER_slist_end (t) != GNUNET_YES; |
437 | GNUNET_CONTAINER_slist_next (t), i += 1) | 436 | GNUNET_CONTAINER_slist_next (t), i += 1) |
438 | { | 437 | { |
439 | struct GNUNET_DISK_FileHandle *fh; | 438 | struct GNUNET_DISK_FileHandle *fh = GNUNET_CONTAINER_slist_get (t, NULL); |
439 | |||
440 | DWORD dwBytes; | 440 | DWORD dwBytes; |
441 | fh = (struct GNUNET_DISK_FileHandle *) GNUNET_CONTAINER_slist_get (t, NULL); | ||
442 | if (fh->type == GNUNET_PIPE) | 441 | if (fh->type == GNUNET_PIPE) |
443 | { | 442 | { |
444 | if (!PeekNamedPipe (fh->h, NULL, 0, NULL, &dwBytes, NULL)) | 443 | if (!PeekNamedPipe (fh->h, NULL, 0, NULL, &dwBytes, NULL)) |
@@ -616,7 +615,9 @@ gnunet_gtk_select (void *cls, | |||
616 | bret = PeekNamedPipe (ml->read_array[i]->h, NULL, 0, NULL, &waitstatus, NULL); | 615 | bret = PeekNamedPipe (ml->read_array[i]->h, NULL, 0, NULL, &waitstatus, NULL); |
617 | error = GetLastError (); | 616 | error = GetLastError (); |
618 | #if DEBUG_NETWORK | 617 | #if DEBUG_NETWORK |
619 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Peek at read pipe %d (0x%x) returned %d (%d bytes available) GLE %u\n", i, ml->read_array[i]->h, bret, waitstatus, error); | 618 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
619 | "Peek at read pipe %d (0x%x) returned %d (%d bytes available) GLE %u\n", | ||
620 | i, ml->read_array[i]->h, bret, waitstatus, error); | ||
620 | #endif | 621 | #endif |
621 | if (bret == 0 || (ml->cached_poll_array[i].revents & G_IO_ERR)) | 622 | if (bret == 0 || (ml->cached_poll_array[i].revents & G_IO_ERR)) |
622 | { | 623 | { |
@@ -627,8 +628,7 @@ gnunet_gtk_select (void *cls, | |||
627 | GNUNET_CONTAINER_slist_end (t) != GNUNET_YES; | 628 | GNUNET_CONTAINER_slist_end (t) != GNUNET_YES; |
628 | GNUNET_CONTAINER_slist_next (t), i += 1) | 629 | GNUNET_CONTAINER_slist_next (t), i += 1) |
629 | { | 630 | { |
630 | struct GNUNET_DISK_FileHandle *fh; | 631 | struct GNUNET_DISK_FileHandle *fh = GNUNET_CONTAINER_slist_get (t, NULL); |
631 | fh = (struct GNUNET_DISK_FileHandle *) GNUNET_CONTAINER_slist_get (t, NULL); | ||
632 | if (fh == ml->read_array[i]) | 632 | if (fh == ml->read_array[i]) |
633 | { | 633 | { |
634 | GNUNET_CONTAINER_slist_add (ml->handles_except, | 634 | GNUNET_CONTAINER_slist_add (ml->handles_except, |
@@ -666,7 +666,9 @@ gnunet_gtk_select (void *cls, | |||
666 | status = send (wfds->sds.fd_array[i], NULL, 0, 0); | 666 | status = send (wfds->sds.fd_array[i], NULL, 0, 0); |
667 | error = GetLastError (); | 667 | error = GetLastError (); |
668 | #if DEBUG_NETWORK | 668 | #if DEBUG_NETWORK |
669 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "send to the socket %d returned %d (%u)\n", i, status, error); | 669 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
670 | "send to the socket %d returned %d (%u)\n", | ||
671 | i, status, error); | ||
670 | #endif | 672 | #endif |
671 | if (status == 0 | 673 | if (status == 0 |
672 | || (error != WSAEWOULDBLOCK && error != WSAENOTCONN) | 674 | || (error != WSAEWOULDBLOCK && error != WSAENOTCONN) |
@@ -686,8 +688,7 @@ gnunet_gtk_select (void *cls, | |||
686 | GNUNET_CONTAINER_slist_end (t) != GNUNET_YES; | 688 | GNUNET_CONTAINER_slist_end (t) != GNUNET_YES; |
687 | GNUNET_CONTAINER_slist_next (t)) | 689 | GNUNET_CONTAINER_slist_next (t)) |
688 | { | 690 | { |
689 | struct GNUNET_DISK_FileHandle *fh; | 691 | struct GNUNET_DISK_FileHandle *fh = GNUNET_CONTAINER_slist_get (t, NULL); |
690 | fh = (struct GNUNET_DISK_FileHandle *) GNUNET_CONTAINER_slist_get (t, NULL); | ||
691 | if (fh->type == GNUNET_PIPE) | 692 | if (fh->type == GNUNET_PIPE) |
692 | CancelIo (fh->h); | 693 | CancelIo (fh->h); |
693 | } | 694 | } |