diff options
author | lurchi <lurchi@strangeplace.net> | 2017-08-09 13:50:09 +0200 |
---|---|---|
committer | lurchi <lurchi@strangeplace.net> | 2017-08-09 13:50:09 +0200 |
commit | 564ca7f14fce740e848b68bf78c358eca53d2c9e (patch) | |
tree | e3d36900fbe9886d5ddda2324bba7bcf367f676e /src | |
parent | 8bff0082dd564946d184b5eb8f7e2b253e65aeee (diff) | |
download | gnunet-564ca7f14fce740e848b68bf78c358eca53d2c9e.tar.gz gnunet-564ca7f14fce740e848b68bf78c358eca53d2c9e.zip |
fix initFdInfo; rename to init_fd_info
Diffstat (limited to 'src')
-rw-r--r-- | src/util/scheduler.c | 47 |
1 files changed, 26 insertions, 21 deletions
diff --git a/src/util/scheduler.c b/src/util/scheduler.c index 8a7155d07..c7471ee0b 100644 --- a/src/util/scheduler.c +++ b/src/util/scheduler.c | |||
@@ -684,57 +684,62 @@ GNUNET_SCHEDULER_get_load (enum GNUNET_SCHEDULER_Priority p) | |||
684 | 684 | ||
685 | 685 | ||
686 | void | 686 | void |
687 | initFdInfo(struct GNUNET_SCHEDULER_Task *t, | 687 | init_fd_info (struct GNUNET_SCHEDULER_Task *t, |
688 | const struct GNUNET_NETWORK_Handle *read_nh, | 688 | const struct GNUNET_NETWORK_Handle *read_nh, |
689 | const struct GNUNET_NETWORK_Handle *write_nh, | 689 | const struct GNUNET_NETWORK_Handle *write_nh, |
690 | const struct GNUNET_DISK_FileHandle *read_fh, | 690 | const struct GNUNET_DISK_FileHandle *read_fh, |
691 | const struct GNUNET_DISK_FileHandle *write_fh) | 691 | const struct GNUNET_DISK_FileHandle *write_fh) |
692 | { | 692 | { |
693 | // either only network handles or only file handles are allowed | 693 | // either only network handles or only file handles are allowed |
694 | GNUNET_assert (!((NULL != read_nh || NULL != write_nh) && (NULL != read_fh || NULL != write_fh))); | 694 | GNUNET_assert (!((NULL != read_nh || NULL != write_nh) && (NULL != read_fh || NULL != write_fh))); |
695 | 695 | ||
696 | if (NULL != read_nh && NULL != write_nh) | 696 | if (NULL != read_nh && NULL != write_nh) |
697 | { | 697 | { |
698 | struct GNUNET_SCHEDULER_FdInfo *fds = GNUNET_new_array (2, struct GNUNET_SCHEDULER_FdInfo); | ||
699 | struct GNUNET_SCHEDULER_FdInfo read_fdi = {.fd = read_nh, .et = GNUNET_SCHEDULER_ET_IN, .sock = GNUNET_NETWORK_get_fd (read_nh)}; | ||
700 | struct GNUNET_SCHEDULER_FdInfo write_fdi = {.fd = write_nh, .et = GNUNET_SCHEDULER_ET_OUT, .sock = GNUNET_NETWORK_get_fd (write_nh)}; | ||
701 | fds[0] = read_fdi; | ||
702 | fds[1] = write_fdi; | ||
703 | t->fds = fds; | ||
698 | t->fds_len = 2; | 704 | t->fds_len = 2; |
699 | t->fds = GNUNET_new_array (2, struct GNUNET_SCHEDULER_FdInfo); | ||
700 | const struct GNUNET_SCHEDULER_FdInfo read_fdi = { .fd = read_nh, .et = GNUNET_SCHEDULER_ET_IN, .sock = GNUNET_NETWORK_get_fd (read_nh)}; | ||
701 | const struct GNUNET_SCHEDULER_FdInfo write_fdi = { .fd = write_nh, .et = GNUNET_SCHEDULER_ET_OUT, .sock = GNUNET_NETWORK_get_fd (write_nh)}; | ||
702 | |||
703 | const struct GNUNET_SCHEDULER_FdInfo array[2] = {read_fdi, write_fdi}; | ||
704 | t->fds = array; | ||
705 | } | 705 | } |
706 | else if (NULL != read_fh && NULL != write_fh) | 706 | else if (NULL != read_fh && NULL != write_fh) |
707 | { | 707 | { |
708 | struct GNUNET_SCHEDULER_FdInfo *fds = GNUNET_new_array (2, struct GNUNET_SCHEDULER_FdInfo); | ||
709 | struct GNUNET_SCHEDULER_FdInfo read_fdi = {.fh = read_fh, .et = GNUNET_SCHEDULER_ET_IN, .sock = read_fh->fd}; | ||
710 | struct GNUNET_SCHEDULER_FdInfo write_fdi = {.fh = write_fh, .et = GNUNET_SCHEDULER_ET_OUT, .sock = write_fh->fd}; | ||
711 | fds[0] = read_fdi; | ||
712 | fds[1] = write_fdi; | ||
713 | t->fds = fds; | ||
708 | t->fds_len = 2; | 714 | t->fds_len = 2; |
709 | t->fds = GNUNET_new_array (2, struct GNUNET_SCHEDULER_FdInfo); | ||
710 | const struct GNUNET_SCHEDULER_FdInfo read_fdi = { .fh = read_fh, .et = GNUNET_SCHEDULER_ET_IN}; | ||
711 | const struct GNUNET_SCHEDULER_FdInfo write_fdi = { .fh = write_fh, .et = GNUNET_SCHEDULER_ET_OUT, .sock = GNUNET_NETWORK_get_fd (write_nh)}; | ||
712 | const struct GNUNET_SCHEDULER_FdInfo array[2] = {read_fdi, write_fdi}; | ||
713 | t->fds = array; | ||
714 | } | 715 | } |
715 | else if (NULL != read_nh) | 716 | else if (NULL != read_nh) |
716 | { | 717 | { |
717 | struct GNUNET_SCHEDULER_FdInfo read_fdi = { .fd = read_nh, .et = GNUNET_SCHEDULER_ET_IN, .sock = GNUNET_NETWORK_get_fd (read_nh)}; | 718 | struct GNUNET_SCHEDULER_FdInfo read_fdi = {.fd = read_nh, .et = GNUNET_SCHEDULER_ET_IN, .sock = GNUNET_NETWORK_get_fd (read_nh)}; |
718 | t->fdx = read_fdi; | 719 | t->fdx = read_fdi; |
719 | t->fds = &t->fdx; | 720 | t->fds = &t->fdx; |
721 | t->read_fd = t->fdx.sock; | ||
720 | } | 722 | } |
721 | else if (NULL != write_nh) | 723 | else if (NULL != write_nh) |
722 | { | 724 | { |
723 | struct GNUNET_SCHEDULER_FdInfo write_fdi = { .fd = write_nh, .et = GNUNET_SCHEDULER_ET_OUT, .sock = GNUNET_NETWORK_get_fd (write_nh)}; | 725 | struct GNUNET_SCHEDULER_FdInfo write_fdi = {.fd = write_nh, .et = GNUNET_SCHEDULER_ET_OUT, .sock = GNUNET_NETWORK_get_fd (write_nh)}; |
724 | t->fdx = write_fdi; | 726 | t->fdx = write_fdi; |
725 | t->fds = &t->fdx; | 727 | t->fds = &t->fdx; |
728 | t->write_fd = t->fdx.sock; | ||
726 | } | 729 | } |
727 | else if (NULL != read_fh) | 730 | else if (NULL != read_fh) |
728 | { | 731 | { |
729 | struct GNUNET_SCHEDULER_FdInfo read_fdi = { .fh = read_fh, .et = GNUNET_SCHEDULER_ET_IN, .sock = read_fh->fd}; | 732 | struct GNUNET_SCHEDULER_FdInfo read_fdi = {.fh = read_fh, .et = GNUNET_SCHEDULER_ET_IN, .sock = read_fh->fd}; |
730 | t->fdx = read_fdi; | 733 | t->fdx = read_fdi; |
731 | t->fds = &t->fdx; | 734 | t->fds = &t->fdx; |
735 | t->read_fd = t->fdx.sock; | ||
732 | } | 736 | } |
733 | else if (NULL != write_fh) | 737 | else if (NULL != write_fh) |
734 | { | 738 | { |
735 | struct GNUNET_SCHEDULER_FdInfo write_fdi = { .fh = write_fh, .et = GNUNET_SCHEDULER_ET_OUT, .sock = write_fh->fd}; | 739 | struct GNUNET_SCHEDULER_FdInfo write_fdi = {.fh = write_fh, .et = GNUNET_SCHEDULER_ET_OUT, .sock = write_fh->fd}; |
736 | t->fdx = write_fdi; | 740 | t->fdx = write_fdi; |
737 | t->fds = &t->fdx; | 741 | t->fds = &t->fdx; |
742 | t->write_fd = t->fdx.sock; | ||
738 | } | 743 | } |
739 | } | 744 | } |
740 | 745 | ||
@@ -1207,7 +1212,7 @@ add_without_sets (struct GNUNET_TIME_Relative delay, | |||
1207 | GNUNET_assert (NULL != active_task); | 1212 | GNUNET_assert (NULL != active_task); |
1208 | GNUNET_assert (NULL != task); | 1213 | GNUNET_assert (NULL != task); |
1209 | t = GNUNET_new (struct GNUNET_SCHEDULER_Task); | 1214 | t = GNUNET_new (struct GNUNET_SCHEDULER_Task); |
1210 | initFdInfo (t, read_nh, write_nh, read_fh, write_fh); | 1215 | init_fd_info (t, read_nh, write_nh, read_fh, write_fh); |
1211 | t->callback = task; | 1216 | t->callback = task; |
1212 | t->callback_cls = task_cls; | 1217 | t->callback_cls = task_cls; |
1213 | #if DEBUG_FDS | 1218 | #if DEBUG_FDS |