gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r17293 - in gnunet: contrib src/include src/util


From: gnunet
Subject: [GNUnet-SVN] r17293 - in gnunet: contrib src/include src/util
Date: Fri, 7 Oct 2011 19:49:10 +0200

Author: grothoff
Date: 2011-10-07 19:49:10 +0200 (Fri, 07 Oct 2011)
New Revision: 17293

Modified:
   gnunet/contrib/gnunet_janitor.py.in
   gnunet/src/include/gnunet_common.h
   gnunet/src/include/gnunet_core_service.h
   gnunet/src/util/common_allocation.c
Log:
LRN: Small janitor fixes

* Prevent janitor from failing if a process can't be killed (it might be dead
  by the time janitor gets around to killing it).
* Fix janitor messages about killing arm/non-arm processes



Modified: gnunet/contrib/gnunet_janitor.py.in
===================================================================
--- gnunet/contrib/gnunet_janitor.py.in 2011-10-07 16:20:21 UTC (rev 17292)
+++ gnunet/contrib/gnunet_janitor.py.in 2011-10-07 17:49:10 UTC (rev 17293)
@@ -55,12 +55,20 @@
       gnunet_procs.append (p)
   for p in gnunet_procs:
     if re.match (r'gnunet-service-arm', p[1]):
-      print ("killing arm {0:5} {1}".format (p[0], p[1]))
-      os.kill (p[0], signal.SIGTERM)
+      print ("killing arm process {0:5} {1}".format (p[0], p[1]))
+      try:
+        os.kill (p[0], signal.SIGTERM)
+      except OSError as e:
+        print ("failed: {0}".format (e))
+        pass
   for p in gnunet_procs:
     if not re.match (r'gnunet-service-arm', p[1]):
-      print ("killing arm {0:5} {1}".format (p[0], p[1]))
-      os.kill (p[0], signal.SIGTERM)
+      print ("killing non-arm process {0:5} {1}".format (p[0], p[1]))
+      try:
+        os.kill (p[0], signal.SIGTERM)
+      except OSError as e:
+        print ("failed: {0}".format (e))
+        pass
 
 if __name__ == '__main__':
   sys.exit (main ())

Modified: gnunet/src/include/gnunet_common.h
===================================================================
--- gnunet/src/include/gnunet_common.h  2011-10-07 16:20:21 UTC (rev 17292)
+++ gnunet/src/include/gnunet_common.h  2011-10-07 17:49:10 UTC (rev 17293)
@@ -569,7 +569,6 @@
 GNUNET_xmalloc_ (size_t size, const char *filename, int linenumber);
 
 
-
 /**
  * Allocate and initialize memory. Checks the return value, aborts if no more
  * memory is available.  Don't use GNUNET_xmemdup_ directly. Use the
@@ -664,6 +663,14 @@
                unsigned int newCount, const char *filename, int linenumber);
 
 
+/**
+ * Create a copy of the given message.
+ *
+ * @param msg message to copy
+ * @return duplicate of the message
+ */
+struct GNUNET_MessageHeader *
+GNUNET_copy_message (const struct GNUNET_MessageHeader *msg);
 
 
 #if __STDC_VERSION__ < 199901L

Modified: gnunet/src/include/gnunet_core_service.h
===================================================================
--- gnunet/src/include/gnunet_core_service.h    2011-10-07 16:20:21 UTC (rev 
17292)
+++ gnunet/src/include/gnunet_core_service.h    2011-10-07 17:49:10 UTC (rev 
17293)
@@ -281,6 +281,7 @@
  * @param info function to call with the resulting configuration information
  * @param info_cls closure for info
  * @return NULL on error
+ * @deprecated will be replaced soon
  */
 struct GNUNET_CORE_InformationRequestContext *
 GNUNET_CORE_peer_change_preference (struct GNUNET_CORE_Handle *h,
@@ -300,6 +301,7 @@
  * from the original request will no longer be called.
  *
  * @param irc context returned by the original GNUNET_CORE_peer_get_info call
+ * @deprecated will be replaced soon
  */
 void
 GNUNET_CORE_peer_change_preference_cancel (struct
@@ -308,7 +310,9 @@
 
 
 /**
- * Iterate over all connected peers.
+ * Iterate over all connected peers.  Calls peer_cb with each
+ * connected peer, and then once with NULL to indicate that all peers
+ * have been handled.
  *
  * @param cfg configuration handle
  * @param peer_cb function to call with the peer information
@@ -320,11 +324,10 @@
                            GNUNET_CORE_ConnectEventHandler peer_cb,
                            void *cb_cls);
 
+
 /**
- * Iterate over all currently connected peers.
- * Calls peer_cb with each connected peer, and then
- * once with NULL to indicate that all peers have
- * been handled.
+ * Check if the given peer is currently connected and return information
+ * about the session if so.
  *
  * @param cfg configuration to use
  * @param peer the specific peer to check for

Modified: gnunet/src/util/common_allocation.c
===================================================================
--- gnunet/src/util/common_allocation.c 2011-10-07 16:20:21 UTC (rev 17292)
+++ gnunet/src/util/common_allocation.c 2011-10-07 17:49:10 UTC (rev 17293)
@@ -332,4 +332,25 @@
   return ret;
 }
 
+
+/**
+ * Create a copy of the given message.
+ *
+ * @param msg message to copy
+ * @return duplicate of the message
+ */
+struct GNUNET_MessageHeader *
+GNUNET_copy_message (const struct GNUNET_MessageHeader *msg)
+{
+  struct GNUNET_MessageHeader *ret;
+  uint16_t msize;
+
+  msize = ntohs (msg->size);
+  GNUNET_assert (msize >= sizeof (struct GNUNET_MessageHeader));
+  ret = GNUNET_malloc (msize);
+  memcpy (ret, msg, msize);
+  return ret;
+}
+
+
 /* end of common_allocation.c */




reply via email to

[Prev in Thread] Current Thread [Next in Thread]