[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[gnunet] branch master updated: subscribes are not reference counted by
From: |
gnunet |
Subject: |
[gnunet] branch master updated: subscribes are not reference counted by postgres, only subscribe/unsubscribe once per connection |
Date: |
Wed, 17 Nov 2021 08:39:05 +0100 |
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 c5a7ce5d2 subscribes are not reference counted by postgres, only
subscribe/unsubscribe once per connection
c5a7ce5d2 is described below
commit c5a7ce5d22f57e3a248ae3e9bc4541a35495b8a1
Author: Christian Grothoff <christian@grothoff.org>
AuthorDate: Wed Nov 17 08:38:55 2021 +0100
subscribes are not reference counted by postgres, only
subscribe/unsubscribe once per connection
---
src/pq/pq_event.c | 20 ++++++++++++++------
1 file changed, 14 insertions(+), 6 deletions(-)
diff --git a/src/pq/pq_event.c b/src/pq/pq_event.c
index 79a2e80c6..283e4569c 100644
--- a/src/pq/pq_event.c
+++ b/src/pq/pq_event.c
@@ -420,6 +420,7 @@ GNUNET_PQ_event_listen (struct GNUNET_PQ_Context *db,
void *cb_cls)
{
struct GNUNET_DB_EventHandler *eh;
+ bool sub;
eh = GNUNET_new (struct GNUNET_DB_EventHandler);
eh->db = db;
@@ -427,6 +428,9 @@ GNUNET_PQ_event_listen (struct GNUNET_PQ_Context *db,
&eh->sh);
eh->cb = cb;
eh->cb_cls = cb_cls;
+ sub = (NULL ==
+ GNUNET_CONTAINER_multishortmap_get (db->channel_map,
+ &eh->sh));
GNUNET_assert (GNUNET_OK ==
GNUNET_CONTAINER_multishortmap_put (db->channel_map,
&eh->sh,
@@ -439,9 +443,10 @@ GNUNET_PQ_event_listen (struct GNUNET_PQ_Context *db,
scheduler_fd_cb (db,
PQsocket (db->conn));
}
- manage_subscribe (db,
- "LISTEN X",
- eh);
+ if (sub)
+ manage_subscribe (db,
+ "LISTEN X",
+ eh);
eh->timeout_task = GNUNET_SCHEDULER_add_delayed (timeout,
&event_timeout,
eh);
@@ -458,9 +463,12 @@ GNUNET_PQ_event_listen_cancel (struct
GNUNET_DB_EventHandler *eh)
GNUNET_CONTAINER_multishortmap_remove (db->channel_map,
&eh->sh,
eh));
- manage_subscribe (db,
- "UNLISTEN X",
- eh);
+ if (NULL ==
+ GNUNET_CONTAINER_multishortmap_get (db->channel_map,
+ &eh->sh))
+ manage_subscribe (db,
+ "UNLISTEN X",
+ eh);
if (0 == GNUNET_CONTAINER_multishortmap_size (db->channel_map))
{
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
--
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: subscribes are not reference counted by postgres, only subscribe/unsubscribe once per connection,
gnunet <=