aboutsummaryrefslogtreecommitdiff
path: root/src/util/service.c
diff options
context:
space:
mode:
authorNathan S. Evans <evans@in.tum.de>2010-07-02 13:00:36 +0000
committerNathan S. Evans <evans@in.tum.de>2010-07-02 13:00:36 +0000
commit4a789496f1b7a453c247b99994839e759155e7b9 (patch)
treefde32cd4adcc5e95d60a196ab692e8a578d26fb6 /src/util/service.c
parent1d938adb4c5c015d6bdef0047177641c808746b7 (diff)
downloadgnunet-4a789496f1b7a453c247b99994839e759155e7b9.tar.gz
gnunet-4a789496f1b7a453c247b99994839e759155e7b9.zip
remove max buffer size from everywhere in util
Diffstat (limited to 'src/util/service.c')
-rw-r--r--src/util/service.c41
1 files changed, 1 insertions, 40 deletions
diff --git a/src/util/service.c b/src/util/service.c
index c34c5aa32..99a364f15 100644
--- a/src/util/service.c
+++ b/src/util/service.c
@@ -499,11 +499,6 @@ struct GNUNET_SERVICE_Context
499 struct GNUNET_TIME_Relative timeout; 499 struct GNUNET_TIME_Relative timeout;
500 500
501 /** 501 /**
502 * Maximum buffer size for the server.
503 */
504 size_t maxbuf;
505
506 /**
507 * Overall success/failure of the service start. 502 * Overall success/failure of the service start.
508 */ 503 */
509 int ret; 504 int ret;
@@ -1077,14 +1072,13 @@ GNUNET_SERVICE_get_server_addresses (const char *serviceName,
1077 1072
1078 1073
1079/** 1074/**
1080 * Setup addr, addrlen, maxbuf, idle_timeout 1075 * Setup addr, addrlen, idle_timeout
1081 * based on configuration! 1076 * based on configuration!
1082 * 1077 *
1083 * Configuration may specify: 1078 * Configuration may specify:
1084 * - PORT (where to bind to for TCP) 1079 * - PORT (where to bind to for TCP)
1085 * - UNIXPATH (where to bind to for UNIX domain sockets) 1080 * - UNIXPATH (where to bind to for UNIX domain sockets)
1086 * - TIMEOUT (after how many ms does an inactive service timeout); 1081 * - TIMEOUT (after how many ms does an inactive service timeout);
1087 * - MAXBUF (maximum incoming message size supported)
1088 * - DISABLEV6 (disable support for IPv6, otherwise we use dual-stack) 1082 * - DISABLEV6 (disable support for IPv6, otherwise we use dual-stack)
1089 * - BINDTO (hostname or IP address to bind to, otherwise we take everything) 1083 * - BINDTO (hostname or IP address to bind to, otherwise we take everything)
1090 * - ACCEPT_FROM (only allow connections from specified IPv4 subnets) 1084 * - ACCEPT_FROM (only allow connections from specified IPv4 subnets)
@@ -1097,7 +1091,6 @@ GNUNET_SERVICE_get_server_addresses (const char *serviceName,
1097static int 1091static int
1098setup_service (struct GNUNET_SERVICE_Context *sctx) 1092setup_service (struct GNUNET_SERVICE_Context *sctx)
1099{ 1093{
1100 unsigned long long maxbuf;
1101 struct GNUNET_TIME_Relative idleout; 1094 struct GNUNET_TIME_Relative idleout;
1102 int tolerant; 1095 int tolerant;
1103 const char *lpid; 1096 const char *lpid;
@@ -1124,23 +1117,6 @@ setup_service (struct GNUNET_SERVICE_Context *sctx)
1124 } 1117 }
1125 else 1118 else
1126 sctx->timeout = GNUNET_TIME_UNIT_FOREVER_REL; 1119 sctx->timeout = GNUNET_TIME_UNIT_FOREVER_REL;
1127 if (GNUNET_CONFIGURATION_have_value (sctx->cfg,
1128 sctx->serviceName, "MAXBUF"))
1129 {
1130 if (GNUNET_OK !=
1131 GNUNET_CONFIGURATION_get_value_number (sctx->cfg,
1132 sctx->serviceName,
1133 "MAXBUF", &maxbuf))
1134 {
1135 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
1136 _("Specified value for `%s' of service `%s' is invalid\n"),
1137 "MAXBUF",
1138 sctx->serviceName);
1139 return GNUNET_SYSERR;
1140 }
1141 }
1142 else
1143 maxbuf = GNUNET_SERVER_MAX_MESSAGE_SIZE - 1;
1144 1120
1145 if (GNUNET_CONFIGURATION_have_value (sctx->cfg, 1121 if (GNUNET_CONFIGURATION_have_value (sctx->cfg,
1146 sctx->serviceName, "TOLERANT")) 1122 sctx->serviceName, "TOLERANT"))
@@ -1201,15 +1177,6 @@ setup_service (struct GNUNET_SERVICE_Context *sctx)
1201 &sctx->addrlens)) ) 1177 &sctx->addrlens)) )
1202 return GNUNET_SYSERR; 1178 return GNUNET_SYSERR;
1203 sctx->require_found = tolerant ? GNUNET_NO : GNUNET_YES; 1179 sctx->require_found = tolerant ? GNUNET_NO : GNUNET_YES;
1204 sctx->maxbuf = (size_t) maxbuf;
1205 if (sctx->maxbuf != maxbuf)
1206 {
1207 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
1208 _
1209 ("Value in configuration for `%s' and service `%s' too large!\n"),
1210 "MAXBUF", sctx->serviceName);
1211 return GNUNET_SYSERR;
1212 }
1213 1180
1214 process_acl4 (&sctx->v4_denied, sctx, "REJECT_FROM"); 1181 process_acl4 (&sctx->v4_denied, sctx, "REJECT_FROM");
1215 process_acl4 (&sctx->v4_allowed, sctx, "ACCEPT_FROM"); 1182 process_acl4 (&sctx->v4_allowed, sctx, "ACCEPT_FROM");
@@ -1324,7 +1291,6 @@ service_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
1324 &check_access, 1291 &check_access,
1325 sctx, 1292 sctx,
1326 sctx->lsocks, 1293 sctx->lsocks,
1327 sctx->maxbuf,
1328 sctx->timeout, sctx->require_found); 1294 sctx->timeout, sctx->require_found);
1329 else 1295 else
1330 sctx->server = GNUNET_SERVER_create (tc->sched, 1296 sctx->server = GNUNET_SERVER_create (tc->sched,
@@ -1332,7 +1298,6 @@ service_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
1332 sctx, 1298 sctx,
1333 sctx->addrs, 1299 sctx->addrs,
1334 sctx->addrlens, 1300 sctx->addrlens,
1335 sctx->maxbuf,
1336 sctx->timeout, sctx->require_found); 1301 sctx->timeout, sctx->require_found);
1337 if (sctx->server == NULL) 1302 if (sctx->server == NULL)
1338 { 1303 {
@@ -1577,7 +1542,6 @@ GNUNET_SERVICE_run (int argc,
1577 sctx.ready_confirm_fd = -1; 1542 sctx.ready_confirm_fd = -1;
1578 sctx.ret = GNUNET_OK; 1543 sctx.ret = GNUNET_OK;
1579 sctx.timeout = GNUNET_TIME_UNIT_FOREVER_REL; 1544 sctx.timeout = GNUNET_TIME_UNIT_FOREVER_REL;
1580 sctx.maxbuf = GNUNET_SERVER_MAX_MESSAGE_SIZE - 1;
1581 sctx.task = task; 1545 sctx.task = task;
1582 sctx.serviceName = serviceName; 1546 sctx.serviceName = serviceName;
1583 sctx.cfg = cfg = GNUNET_CONFIGURATION_create (); 1547 sctx.cfg = cfg = GNUNET_CONFIGURATION_create ();
@@ -1656,7 +1620,6 @@ GNUNET_SERVICE_start (const char *serviceName,
1656 sctx->ready_confirm_fd = -1; /* no daemonizing */ 1620 sctx->ready_confirm_fd = -1; /* no daemonizing */
1657 sctx->ret = GNUNET_OK; 1621 sctx->ret = GNUNET_OK;
1658 sctx->timeout = GNUNET_TIME_UNIT_FOREVER_REL; 1622 sctx->timeout = GNUNET_TIME_UNIT_FOREVER_REL;
1659 sctx->maxbuf = GNUNET_SERVER_MAX_MESSAGE_SIZE;
1660 sctx->serviceName = serviceName; 1623 sctx->serviceName = serviceName;
1661 sctx->cfg = cfg; 1624 sctx->cfg = cfg;
1662 sctx->sched = sched; 1625 sctx->sched = sched;
@@ -1672,7 +1635,6 @@ GNUNET_SERVICE_start (const char *serviceName,
1672 &check_access, 1635 &check_access,
1673 sctx, 1636 sctx,
1674 sctx->lsocks, 1637 sctx->lsocks,
1675 sctx->maxbuf,
1676 sctx->timeout, sctx->require_found); 1638 sctx->timeout, sctx->require_found);
1677 else 1639 else
1678 sctx->server = GNUNET_SERVER_create (sched, 1640 sctx->server = GNUNET_SERVER_create (sched,
@@ -1680,7 +1642,6 @@ GNUNET_SERVICE_start (const char *serviceName,
1680 sctx, 1642 sctx,
1681 sctx->addrs, 1643 sctx->addrs,
1682 sctx->addrlens, 1644 sctx->addrlens,
1683 sctx->maxbuf,
1684 sctx->timeout, 1645 sctx->timeout,
1685 sctx->require_found); 1646 sctx->require_found);
1686 1647