[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r6835 - in GNUnet/src: applications/datastore applications/
From: |
gnunet |
Subject: |
[GNUnet-SVN] r6835 - in GNUnet/src: applications/datastore applications/fs/ecrs applications/fs/gap server util/loggers |
Date: |
Sun, 18 May 2008 12:48:16 -0600 (MDT) |
Author: grothoff
Date: 2008-05-18 12:48:15 -0600 (Sun, 18 May 2008)
New Revision: 6835
Modified:
GNUnet/src/applications/datastore/datastore.c
GNUnet/src/applications/fs/ecrs/meta.c
GNUnet/src/applications/fs/ecrs/upload.c
GNUnet/src/applications/fs/gap/fs.c
GNUnet/src/server/tcpserver.c
GNUnet/src/util/loggers/memory.c
Log:
fixing logging to client and issue related to #1338: upload over quota was not
reported nicely
Modified: GNUnet/src/applications/datastore/datastore.c
===================================================================
--- GNUnet/src/applications/datastore/datastore.c 2008-05-18 13:02:33 UTC
(rev 6834)
+++ GNUnet/src/applications/datastore/datastore.c 2008-05-18 18:48:15 UTC
(rev 6835)
@@ -277,12 +277,14 @@
ntohl (value->priority) + comp_prio);
#endif
/* check if we have enough space / priority */
- if ((available < ntohl (value->size)) &&
- (minPriority > ntohl (value->priority) + comp_prio))
+ if ( (available < ntohl (value->size)) ||
+ (minPriority >= ntohl (value->priority) + comp_prio) )
{
+ /* new content either does not fit (for sure)
+ or has such a low priority that we should
+ not even bother! */
GNUNET_mutex_unlock (lock);
- return GNUNET_NO; /* new content has such a low priority that
- we should not even bother! */
+ return GNUNET_NO;
}
if (ntohl (value->priority) + comp_prio < minPriority)
minPriority = ntohl (value->priority) + comp_prio;
@@ -317,6 +319,7 @@
if (GNUNET_get_time () < GNUNET_ntohll (value->expiration_time))
return GNUNET_SYSERR; /* not expired */
available += ntohl (value->size);
+ minPriority = 0;
return GNUNET_NO;
}
@@ -327,7 +330,8 @@
{
if ((available > 0) && (available >= MIN_GNUNET_free))
return GNUNET_SYSERR;
- minPriority = ntohl (value->priority);
+ if (ntohl (value->priority) > minPriority)
+ minPriority = ntohl (value->priority);
available += ntohl (value->size);
return GNUNET_NO;
}
@@ -350,10 +354,6 @@
sq->iterateLowPriority (GNUNET_ECRS_BLOCKTYPE_ANY,
&freeSpaceLow, NULL);
}
- else
- {
- minPriority = 0;
- }
}
/**
Modified: GNUnet/src/applications/fs/ecrs/meta.c
===================================================================
--- GNUnet/src/applications/fs/ecrs/meta.c 2008-05-18 13:02:33 UTC (rev
6834)
+++ GNUnet/src/applications/fs/ecrs/meta.c 2008-05-18 18:48:15 UTC (rev
6835)
@@ -99,8 +99,8 @@
/* remove hints to OS */
if (type == EXTRACTOR_FILENAME) {
- while (p = strchr(p, '\\'))
- *p = '/';
+ while ((p = strchr(p, '\\')))
+ *p = '/';
}
return GNUNET_OK;
Modified: GNUnet/src/applications/fs/ecrs/upload.c
===================================================================
--- GNUnet/src/applications/fs/ecrs/upload.c 2008-05-18 13:02:33 UTC (rev
6834)
+++ GNUnet/src/applications/fs/ecrs/upload.c 2008-05-18 18:48:15 UTC (rev
6835)
@@ -132,6 +132,7 @@
unsigned int treedepth;
int fd;
int i;
+ int ret;
unsigned int size;
GNUNET_DatastoreValue **iblocks;
GNUNET_DatastoreValue *dblock;
@@ -329,9 +330,9 @@
GNUNET_GE_ASSERT (ectx, value != NULL);
*value = *dblock; /* copy options! */
if ((doIndex == GNUNET_NO) &&
- (GNUNET_SYSERR == GNUNET_FS_insert (sock, value)))
+ (GNUNET_OK != (ret = GNUNET_FS_insert (sock, value))))
{
- GNUNET_GE_BREAK (ectx, 0);
+ GNUNET_GE_BREAK (ectx, ret == GNUNET_NO);
GNUNET_free (value);
goto FAILURE;
}
Modified: GNUnet/src/applications/fs/gap/fs.c
===================================================================
--- GNUnet/src/applications/fs/gap/fs.c 2008-05-18 13:02:33 UTC (rev 6834)
+++ GNUnet/src/applications/fs/gap/fs.c 2008-05-18 18:48:15 UTC (rev 6835)
@@ -107,6 +107,7 @@
{
const CS_fs_request_insert_MESSAGE *ri;
GNUNET_DatastoreValue *datum;
+ struct GNUNET_GE_Context *cectx;
GNUNET_HashCode query;
int ret;
#if DEBUG_FS
@@ -148,6 +149,14 @@
memcpy (&datum[1],
&ri[1], ntohs (req->size) - sizeof (CS_fs_request_insert_MESSAGE));
ret = datastore->putUpdate (&query, datum);
+ if (ret == GNUNET_NO)
+ {
+ cectx = coreAPI->cs_log_context_create (sock);
+ GNUNET_GE_LOG (cectx,
+ GNUNET_GE_ERROR | GNUNET_GE_BULK | GNUNET_GE_USER,
+ _("Datastore full.\n"));
+ GNUNET_GE_free_context (cectx);
+ }
GNUNET_free (datum);
return coreAPI->cs_send_value (sock, ret);
}
Modified: GNUnet/src/server/tcpserver.c
===================================================================
--- GNUnet/src/server/tcpserver.c 2008-05-18 13:02:33 UTC (rev 6834)
+++ GNUnet/src/server/tcpserver.c 2008-05-18 18:48:15 UTC (rev 6835)
@@ -20,7 +20,7 @@
/**
* @file server/tcpserver.c
- * @brief TCP server (gnunetd-client communication using util/tcpio.c).
+ * @brief TCP server (gnunetd-client communication using
util/network_client/tcpio.c).
* @author Christian Grothoff
*
* TODO: configuration management (signaling of configuration change)
@@ -655,7 +655,7 @@
msgLen = 60000;
rv = GNUNET_malloc (sizeof (GNUNET_MessageReturnErrorMessage) + msgLen);
memset (rv, 0, sizeof (GNUNET_MessageReturnErrorMessage) + msgLen);
- rv->header.size = htons (sizeof (GNUNET_MessageHeader) + msgLen);
+ rv->header.size = htons (sizeof (GNUNET_MessageReturnErrorMessage) + msgLen);
rv->header.type = htons (GNUNET_CS_PROTO_RETURN_ERROR);
rv->kind = htonl (kind);
memcpy (&rv[1], message, strlen (message));
Modified: GNUnet/src/util/loggers/memory.c
===================================================================
--- GNUnet/src/util/loggers/memory.c 2008-05-18 13:02:33 UTC (rev 6834)
+++ GNUnet/src/util/loggers/memory.c 2008-05-18 18:48:15 UTC (rev 6835)
@@ -69,7 +69,7 @@
if (ctx->pos == ctx->maxSize - 1)
{
ctx->messages[ctx->pos].msg =
- GNUNET_strdup (_("Out of memory (for logging)"));
+ GNUNET_strdup (_("Out of memory (for logging)\n"));
ctx->messages[ctx->pos].mask =
GNUNET_GE_STATUS | GNUNET_GE_USER | GNUNET_GE_BULK;
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r6835 - in GNUnet/src: applications/datastore applications/fs/ecrs applications/fs/gap server util/loggers,
gnunet <=