diff options
author | Nathan S. Evans <evans@in.tum.de> | 2010-11-05 18:21:50 +0000 |
---|---|---|
committer | Nathan S. Evans <evans@in.tum.de> | 2010-11-05 18:21:50 +0000 |
commit | 75a33a1499cf60ea4364c9aa673816629a6c1413 (patch) | |
tree | 0620da4312bb04de4d7b65074fdd3b0c3dd6cc0e /src/util/service.c | |
parent | 7217c601ad30760872823193d62307e7a335d226 (diff) | |
download | gnunet-75a33a1499cf60ea4364c9aa673816629a6c1413.tar.gz gnunet-75a33a1499cf60ea4364c9aa673816629a6c1413.zip |
big scheduler refactoring, expect some issues
Diffstat (limited to 'src/util/service.c')
-rw-r--r-- | src/util/service.c | 26 |
1 files changed, 6 insertions, 20 deletions
diff --git a/src/util/service.c b/src/util/service.c index d18d4e9e3..3423b58cb 100644 --- a/src/util/service.c +++ b/src/util/service.c | |||
@@ -430,11 +430,6 @@ struct GNUNET_SERVICE_Context | |||
430 | struct GNUNET_SERVER_Handle *server; | 430 | struct GNUNET_SERVER_Handle *server; |
431 | 431 | ||
432 | /** | 432 | /** |
433 | * Scheduler for the server. | ||
434 | */ | ||
435 | struct GNUNET_SCHEDULER_Handle *sched; | ||
436 | |||
437 | /** | ||
438 | * NULL-terminated array of addresses to bind to, NULL if we got pre-bound | 433 | * NULL-terminated array of addresses to bind to, NULL if we got pre-bound |
439 | * listen sockets. | 434 | * listen sockets. |
440 | */ | 435 | */ |
@@ -1290,16 +1285,13 @@ service_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
1290 | struct GNUNET_SERVICE_Context *sctx = cls; | 1285 | struct GNUNET_SERVICE_Context *sctx = cls; |
1291 | unsigned int i; | 1286 | unsigned int i; |
1292 | 1287 | ||
1293 | sctx->sched = tc->sched; | ||
1294 | if (sctx->lsocks != NULL) | 1288 | if (sctx->lsocks != NULL) |
1295 | sctx->server = GNUNET_SERVER_create_with_sockets (tc->sched, | 1289 | sctx->server = GNUNET_SERVER_create_with_sockets (&check_access, |
1296 | &check_access, | ||
1297 | sctx, | 1290 | sctx, |
1298 | sctx->lsocks, | 1291 | sctx->lsocks, |
1299 | sctx->timeout, sctx->require_found); | 1292 | sctx->timeout, sctx->require_found); |
1300 | else | 1293 | else |
1301 | sctx->server = GNUNET_SERVER_create (tc->sched, | 1294 | sctx->server = GNUNET_SERVER_create (&check_access, |
1302 | &check_access, | ||
1303 | sctx, | 1295 | sctx, |
1304 | sctx->addrs, | 1296 | sctx->addrs, |
1305 | sctx->addrlens, | 1297 | sctx->addrlens, |
@@ -1325,8 +1317,7 @@ service_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
1325 | { | 1317 | { |
1326 | /* install a task that will kill the server | 1318 | /* install a task that will kill the server |
1327 | process if the scheduler ever gets a shutdown signal */ | 1319 | process if the scheduler ever gets a shutdown signal */ |
1328 | GNUNET_SCHEDULER_add_delayed (tc->sched, | 1320 | GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL, |
1329 | GNUNET_TIME_UNIT_FOREVER_REL, | ||
1330 | &shutdown_task, sctx->server); | 1321 | &shutdown_task, sctx->server); |
1331 | } | 1322 | } |
1332 | sctx->my_handlers = GNUNET_malloc (sizeof (defhandlers)); | 1323 | sctx->my_handlers = GNUNET_malloc (sizeof (defhandlers)); |
@@ -1354,7 +1345,7 @@ service_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
1354 | i++; | 1345 | i++; |
1355 | } | 1346 | } |
1356 | } | 1347 | } |
1357 | sctx->task (sctx->task_cls, tc->sched, sctx->server, sctx->cfg); | 1348 | sctx->task (sctx->task_cls, sctx->server, sctx->cfg); |
1358 | } | 1349 | } |
1359 | 1350 | ||
1360 | 1351 | ||
@@ -1612,13 +1603,11 @@ shutdown: | |||
1612 | * initialized system. | 1603 | * initialized system. |
1613 | * | 1604 | * |
1614 | * @param serviceName our service name | 1605 | * @param serviceName our service name |
1615 | * @param sched scheduler to use | ||
1616 | * @param cfg configuration to use | 1606 | * @param cfg configuration to use |
1617 | * @return NULL on error, service handle | 1607 | * @return NULL on error, service handle |
1618 | */ | 1608 | */ |
1619 | struct GNUNET_SERVICE_Context * | 1609 | struct GNUNET_SERVICE_Context * |
1620 | GNUNET_SERVICE_start (const char *serviceName, | 1610 | GNUNET_SERVICE_start (const char *serviceName, |
1621 | struct GNUNET_SCHEDULER_Handle *sched, | ||
1622 | const struct GNUNET_CONFIGURATION_Handle *cfg) | 1611 | const struct GNUNET_CONFIGURATION_Handle *cfg) |
1623 | { | 1612 | { |
1624 | int i; | 1613 | int i; |
@@ -1630,7 +1619,6 @@ GNUNET_SERVICE_start (const char *serviceName, | |||
1630 | sctx->timeout = GNUNET_TIME_UNIT_FOREVER_REL; | 1619 | sctx->timeout = GNUNET_TIME_UNIT_FOREVER_REL; |
1631 | sctx->serviceName = serviceName; | 1620 | sctx->serviceName = serviceName; |
1632 | sctx->cfg = cfg; | 1621 | sctx->cfg = cfg; |
1633 | sctx->sched = sched; | ||
1634 | 1622 | ||
1635 | /* setup subsystems */ | 1623 | /* setup subsystems */ |
1636 | if (GNUNET_OK != setup_service (sctx)) | 1624 | if (GNUNET_OK != setup_service (sctx)) |
@@ -1639,14 +1627,12 @@ GNUNET_SERVICE_start (const char *serviceName, | |||
1639 | return NULL; | 1627 | return NULL; |
1640 | } | 1628 | } |
1641 | if (sctx->lsocks != NULL) | 1629 | if (sctx->lsocks != NULL) |
1642 | sctx->server = GNUNET_SERVER_create_with_sockets (sched, | 1630 | sctx->server = GNUNET_SERVER_create_with_sockets (&check_access, |
1643 | &check_access, | ||
1644 | sctx, | 1631 | sctx, |
1645 | sctx->lsocks, | 1632 | sctx->lsocks, |
1646 | sctx->timeout, sctx->require_found); | 1633 | sctx->timeout, sctx->require_found); |
1647 | else | 1634 | else |
1648 | sctx->server = GNUNET_SERVER_create (sched, | 1635 | sctx->server = GNUNET_SERVER_create (&check_access, |
1649 | &check_access, | ||
1650 | sctx, | 1636 | sctx, |
1651 | sctx->addrs, | 1637 | sctx->addrs, |
1652 | sctx->addrlens, | 1638 | sctx->addrlens, |