[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[gnunet] branch master updated: -code cleanup plus one new assertion to
From: |
gnunet |
Subject: |
[gnunet] branch master updated: -code cleanup plus one new assertion to debug madmurphy issue |
Date: |
Fri, 28 Oct 2022 23:14:48 +0200 |
This is an automated email from the git hooks/post-receive script.
grothoff pushed a commit to branch master
in repository gnunet.
The following commit(s) were added to refs/heads/master by this push:
new a98fecfbf -code cleanup plus one new assertion to debug madmurphy issue
a98fecfbf is described below
commit a98fecfbfa095ceee45b963c07480ed9331c48e2
Author: Christian Grothoff <christian@grothoff.org>
AuthorDate: Fri Oct 28 23:14:38 2022 +0200
-code cleanup plus one new assertion to debug madmurphy issue
---
src/fs/fs_api.c | 38 +++++++++++++-------------------------
src/fs/fs_list_indexed.c | 6 ++++--
src/fs/gnunet-fs.c | 2 +-
src/include/gnunet_mst_lib.h | 2 +-
src/util/client.c | 7 ++++---
src/util/mq.c | 1 +
src/util/mst.c | 21 ++++++++++-----------
7 files changed, 34 insertions(+), 43 deletions(-)
diff --git a/src/fs/fs_api.c b/src/fs/fs_api.c
index c1b5ef84b..6e97a3812 100644
--- a/src/fs/fs_api.c
+++ b/src/fs/fs_api.c
@@ -3190,16 +3190,20 @@ deserialize_download_file (void *cls, const char
*filename)
if (NULL == rh)
{
if (0 != unlink (filename))
- GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_WARNING, "unlink", filename);
+ GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_WARNING,
+ "unlink",
+ filename);
GNUNET_free (set);
return GNUNET_OK;
}
deserialize_download (h, rh, NULL, NULL, set);
GNUNET_free (set);
- if (GNUNET_OK != GNUNET_BIO_read_close (rh, &emsg))
+ if (GNUNET_OK !=
+ GNUNET_BIO_read_close (rh,
+ &emsg))
{
GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
- _ ("Failure while resuming download operation `%s': %s\n"),
+ "Failure while resuming download operation `%s': %s\n",
filename,
emsg);
GNUNET_free (emsg);
@@ -3225,23 +3229,16 @@ deserialization_master (const char *master_path,
dn = get_serialization_file_name (h, master_path, "");
if (NULL == dn)
return;
- if (GNUNET_YES == GNUNET_DISK_directory_test (dn, GNUNET_YES))
- GNUNET_DISK_directory_scan (dn, proc, h);
+ if (GNUNET_YES ==
+ GNUNET_DISK_directory_test (dn,
+ GNUNET_YES))
+ GNUNET_DISK_directory_scan (dn,
+ proc,
+ h);
GNUNET_free (dn);
}
-/**
- * Setup a connection to the file-sharing service.
- *
- * @param cfg configuration to use
- * @param client_name unique identifier for this client
- * @param upcb function to call to notify about FS actions
- * @param upcb_cls closure for @a upcb
- * @param flags specific attributes for fs-operations
- * @param ... list of optional options, terminated with #GNUNET_FS_OPTIONS_END
- * @return NULL on error
- */
struct GNUNET_FS_Handle *
GNUNET_FS_start (const struct GNUNET_CONFIGURATION_Handle *cfg,
const char *client_name,
@@ -3308,15 +3305,6 @@ GNUNET_FS_start (const struct
GNUNET_CONFIGURATION_Handle *cfg,
}
-/**
- * Close our connection with the file-sharing service.
- * The callback given to #GNUNET_FS_start() will no longer be
- * called after this function returns.
- * This function MUST NOT be called from within the
- * callback itself.
- *
- * @param h handle that was returned from #GNUNET_FS_start()
- */
void
GNUNET_FS_stop (struct GNUNET_FS_Handle *h)
{
diff --git a/src/fs/fs_list_indexed.c b/src/fs/fs_list_indexed.c
index 7cd6161e3..eaee4ce55 100644
--- a/src/fs/fs_list_indexed.c
+++ b/src/fs/fs_list_indexed.c
@@ -148,10 +148,12 @@ mq_error_handler (void *cls,
struct GNUNET_FS_GetIndexedContext *gic = cls;
GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
- _ ("Failed to receive response from `%s' service (error code is
%d).\n"),
+ "Failed to receive response from `%s' service (error code is
%d).\n",
"fs",
error);
- (void) gic->iterator (gic->iterator_cls, NULL, NULL);
+ (void) gic->iterator (gic->iterator_cls,
+ NULL,
+ NULL);
GNUNET_FS_get_indexed_files_cancel (gic);
}
diff --git a/src/fs/gnunet-fs.c b/src/fs/gnunet-fs.c
index f9d63e101..0f8f02a1c 100644
--- a/src/fs/gnunet-fs.c
+++ b/src/fs/gnunet-fs.c
@@ -57,7 +57,7 @@ static unsigned int verbose;
* @param cls closure
* @param filename the name of the file
* @param file_id hash of the contents of the indexed file
- * @return GNUNET_OK to continue iteration
+ * @return #GNUNET_OK to continue iteration
*/
static enum GNUNET_GenericReturnValue
print_indexed (void *cls,
diff --git a/src/include/gnunet_mst_lib.h b/src/include/gnunet_mst_lib.h
index 43a8ab838..ec82ce357 100644
--- a/src/include/gnunet_mst_lib.h
+++ b/src/include/gnunet_mst_lib.h
@@ -103,7 +103,7 @@ GNUNET_MST_create (GNUNET_MessageTokenizerCallback cb,
* #GNUNET_NO if one_shot was set and we have another message ready
* #GNUNET_SYSERR if the data stream is corrupt
*/
-int
+enum GNUNET_GenericReturnValue
GNUNET_MST_from_buffer (struct GNUNET_MessageStreamTokenizer *mst,
const char *buf,
size_t size,
diff --git a/src/util/client.c b/src/util/client.c
index 686e0562a..91e0c1a85 100644
--- a/src/util/client.c
+++ b/src/util/client.c
@@ -267,7 +267,7 @@ transmit_ready (void *cls)
cstate->sock,
cstate->mq);
- RETRY:
+RETRY:
ret = GNUNET_NETWORK_socket_send (cstate->sock,
&pos[cstate->msg_off],
len - cstate->msg_off);
@@ -330,7 +330,7 @@ transmit_ready (void *cls)
* #GNUNET_NO to stop further processing due to disconnect (no error)
* #GNUNET_SYSERR to stop further processing due to error
*/
-static int
+static enum GNUNET_GenericReturnValue
recv_message (void *cls,
const struct GNUNET_MessageHeader *msg)
{
@@ -439,7 +439,7 @@ static void
receive_ready (void *cls)
{
struct ClientState *cstate = cls;
- int ret;
+ enum GNUNET_GenericReturnValue ret;
cstate->recv_task = NULL;
cstate->in_destroy = GNUNET_SYSERR;
@@ -464,6 +464,7 @@ receive_ready (void *cls)
return;
}
cstate->in_destroy = GNUNET_NO;
+ GNUNET_assert (NULL == cstate->recv_task);
cstate->recv_task
= GNUNET_SCHEDULER_add_read_net (GNUNET_TIME_UNIT_FOREVER_REL,
cstate->sock,
diff --git a/src/util/mq.c b/src/util/mq.c
index 8749d5d21..585389ce8 100644
--- a/src/util/mq.c
+++ b/src/util/mq.c
@@ -192,6 +192,7 @@ GNUNET_MQ_inject_message (struct GNUNET_MQ_Handle *mq,
mh);
if (GNUNET_SYSERR == ret)
{
+ GNUNET_break_op (0);
GNUNET_MQ_inject_error (mq,
GNUNET_MQ_ERROR_MALFORMED);
return;
diff --git a/src/util/mst.c b/src/util/mst.c
index 264fdb979..18f144906 100644
--- a/src/util/mst.c
+++ b/src/util/mst.c
@@ -96,7 +96,7 @@ GNUNET_MST_create (GNUNET_MessageTokenizerCallback cb,
}
-int
+enum GNUNET_GenericReturnValue
GNUNET_MST_from_buffer (struct GNUNET_MessageStreamTokenizer *mst,
const char *buf,
size_t size,
@@ -107,8 +107,6 @@ GNUNET_MST_from_buffer (struct
GNUNET_MessageStreamTokenizer *mst,
size_t delta;
uint16_t want;
char *ibuf;
- int need_align;
- unsigned long offset;
int ret;
int cbret;
@@ -124,7 +122,7 @@ GNUNET_MST_from_buffer (struct
GNUNET_MessageStreamTokenizer *mst,
ibuf = (char *) mst->hdr;
while (mst->pos > 0)
{
- do_align:
+do_align:
GNUNET_assert (mst->pos >= mst->off);
if ((mst->curr_buf - mst->off < sizeof(struct GNUNET_MessageHeader)) ||
(0 != (mst->off % ALIGN_FACTOR)))
@@ -240,14 +238,15 @@ GNUNET_MST_from_buffer (struct
GNUNET_MessageStreamTokenizer *mst,
GNUNET_assert (0 == mst->pos);
while (size > 0)
{
+ unsigned long offset = (unsigned long) buf;
+ bool need_align = (0 != (offset % ALIGN_FACTOR));
+
LOG (GNUNET_ERROR_TYPE_DEBUG,
"Server-mst has %u bytes left in inbound buffer\n",
(unsigned int) size);
if (size < sizeof(struct GNUNET_MessageHeader))
break;
- offset = (unsigned long) buf;
- need_align = (0 != (offset % ALIGN_FACTOR)) ? GNUNET_YES : GNUNET_NO;
- if (GNUNET_NO == need_align)
+ if (! need_align)
{
/* can try to do zero-copy and process directly from original buffer */
hdr = (const struct GNUNET_MessageHeader *) buf;
@@ -267,7 +266,7 @@ GNUNET_MST_from_buffer (struct
GNUNET_MessageStreamTokenizer *mst,
ret = GNUNET_NO;
goto copy;
}
- if (one_shot == GNUNET_YES)
+ if (GNUNET_YES == one_shot)
one_shot = GNUNET_SYSERR;
if (GNUNET_OK !=
(cbret = mst->cb (mst->cb_cls,
@@ -290,7 +289,7 @@ GNUNET_MST_from_buffer (struct
GNUNET_MessageStreamTokenizer *mst,
goto do_align;
}
}
- copy:
+copy:
if ((size > 0) && (! purge))
{
if (size + mst->pos > mst->curr_buf)
@@ -334,7 +333,7 @@ GNUNET_MST_from_buffer (struct
GNUNET_MessageStreamTokenizer *mst,
* #GNUNET_NO if one_shot was set and we have another message ready
* #GNUNET_SYSERR if the data stream is corrupt
*/
-int
+enum GNUNET_GenericReturnValue
GNUNET_MST_read (struct GNUNET_MessageStreamTokenizer *mst,
struct GNUNET_NETWORK_Handle *sock,
int purge,
@@ -383,7 +382,7 @@ GNUNET_MST_read (struct GNUNET_MessageStreamTokenizer *mst,
* #GNUNET_NO if one_shot was set and we have another message ready
* #GNUNET_SYSERR if the data stream is corrupt
*/
-int
+enum GNUNET_GenericReturnValue
GNUNET_MST_next (struct GNUNET_MessageStreamTokenizer *mst,
int one_shot)
{
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [gnunet] branch master updated: -code cleanup plus one new assertion to debug madmurphy issue,
gnunet <=