<feed xmlns='http://www.w3.org/2005/Atom'>
<title>delta/NetworkManager.git/examples, branch fix-eBPF</title>
<subtitle>gitlab.freedesktop.org: NetworkManager/NetworkManager.git
</subtitle>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/NetworkManager.git/'/>
<entry>
<title>examples: fix code formatting in "gmaincontext.py"</title>
<updated>2022-10-25T14:47:48+00:00</updated>
<author>
<name>Thomas Haller</name>
<email>thaller@redhat.com</email>
</author>
<published>2022-10-25T14:47:33+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/NetworkManager.git/commit/?id=37ccc08abf49b26a6d09bbb7c66517bb2a604b78'/>
<id>37ccc08abf49b26a6d09bbb7c66517bb2a604b78</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>examples: avoid unreachable code in "gmaincontext.py"</title>
<updated>2022-10-25T10:36:43+00:00</updated>
<author>
<name>Thomas Haller</name>
<email>thaller@redhat.com</email>
</author>
<published>2022-10-25T10:36:37+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/NetworkManager.git/commit/?id=c34c8fdb823df72fbc3c2332f5ee08116aab3044'/>
<id>c34c8fdb823df72fbc3c2332f5ee08116aab3044</id>
<content type='text'>
lgtm.com warns about this. Avoid it.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
lgtm.com warns about this. Avoid it.
</pre>
</div>
</content>
</entry>
<entry>
<title>examples: drop unused import from "gmaincontext.py" example</title>
<updated>2022-10-25T10:11:19+00:00</updated>
<author>
<name>Thomas Haller</name>
<email>thaller@redhat.com</email>
</author>
<published>2022-10-25T10:10:46+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/NetworkManager.git/commit/?id=85d5fb210b4d8eabfbfe730c9a7e6eff616d1657'/>
<id>85d5fb210b4d8eabfbfe730c9a7e6eff616d1657</id>
<content type='text'>
Complained by lgtm.com.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Complained by lgtm.com.
</pre>
</div>
</content>
</entry>
<entry>
<title>examples: avoid lgtm warning about calling traceback.format_exception()</title>
<updated>2022-10-25T10:01:54+00:00</updated>
<author>
<name>Thomas Haller</name>
<email>thaller@redhat.com</email>
</author>
<published>2022-10-25T10:01:12+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/NetworkManager.git/commit/?id=9b80860ff420cbd39d58d552d39d130465471af6'/>
<id>9b80860ff420cbd39d58d552d39d130465471af6</id>
<content type='text'>
lgtm.com says:

  Call to function format_exception with too few arguments; should be no
  fewer than 3.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
lgtm.com says:

  Call to function format_exception with too few arguments; should be no
  fewer than 3.
</pre>
</div>
</content>
</entry>
<entry>
<title>libnm: add nm_client_wait_shutdown() function for cleaning up NMClient</title>
<updated>2022-10-14T15:48:24+00:00</updated>
<author>
<name>Thomas Haller</name>
<email>thaller@redhat.com</email>
</author>
<published>2022-10-05T10:22:51+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/NetworkManager.git/commit/?id=88724ff169a1796d4cdfbd4f116e08769de1c12f'/>
<id>88724ff169a1796d4cdfbd4f116e08769de1c12f</id>
<content type='text'>
Add a fire-and-forget function to wait for shutdown to be complete.

It's not entirely trivial to ensure all resources of NMClient are
cleaned up. That matters only if NMClient uses a temporary GMainContext
that the user wants to release while the application continues. For
example, to do some short-lived operations an a worker thread. It's
not trivial also because glib provides no convenient API to integrate
a GMainContext in another GMainContext. We have that code as
nm_utils_g_main_context_create_integrate_source(), so add a helper
function to allow the user to do this.

The function allows to omit the callback, in which case the caller
wouldn't know when shutdown is complete. That would still be useful
however, when integrating the client's context into the caller's
context, so that the client's context gets automatically iterated
until completion.

The following test script will run out of file descriptors,
when wait_shutdown() is not used:

   #!/bin/python

   import gi

   gi.require_version("NM", "1.0")
   from gi.repository import NM, GLib

   for i in range(1200):
       print(f"&gt;&gt;&gt;{i}")

       ctx = GLib.MainContext()
       ctx.push_thread_default()
       nmc = NM.Client.new()
       ctx.pop_thread_default()

       def cb(unused, result, i):
           try:
               NM.Client.wait_shutdown_finish(result)
           except Exception:
               # cannot happen
               assert False
           else:
               print(f"&gt;&gt;&gt;&gt;&gt; {i} complete")

       nmc.wait_shutdown(True, None, cb, i)

       while GLib.MainContext.default().iteration(False):
           pass
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Add a fire-and-forget function to wait for shutdown to be complete.

It's not entirely trivial to ensure all resources of NMClient are
cleaned up. That matters only if NMClient uses a temporary GMainContext
that the user wants to release while the application continues. For
example, to do some short-lived operations an a worker thread. It's
not trivial also because glib provides no convenient API to integrate
a GMainContext in another GMainContext. We have that code as
nm_utils_g_main_context_create_integrate_source(), so add a helper
function to allow the user to do this.

The function allows to omit the callback, in which case the caller
wouldn't know when shutdown is complete. That would still be useful
however, when integrating the client's context into the caller's
context, so that the client's context gets automatically iterated
until completion.

The following test script will run out of file descriptors,
when wait_shutdown() is not used:

   #!/bin/python

   import gi

   gi.require_version("NM", "1.0")
   from gi.repository import NM, GLib

   for i in range(1200):
       print(f"&gt;&gt;&gt;{i}")

       ctx = GLib.MainContext()
       ctx.push_thread_default()
       nmc = NM.Client.new()
       ctx.pop_thread_default()

       def cb(unused, result, i):
           try:
               NM.Client.wait_shutdown_finish(result)
           except Exception:
               # cannot happen
               assert False
           else:
               print(f"&gt;&gt;&gt;&gt;&gt; {i} complete")

       nmc.wait_shutdown(True, None, cb, i)

       while GLib.MainContext.default().iteration(False):
           pass
</pre>
</div>
</content>
</entry>
<entry>
<title>examples: fix tracking destruction in destroy_nmc()</title>
<updated>2022-07-13T08:05:12+00:00</updated>
<author>
<name>Thomas Haller</name>
<email>thaller@redhat.com</email>
</author>
<published>2022-07-13T08:04:56+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/NetworkManager.git/commit/?id=9511ac7d20b4fdd471039d7756a912f319111c8a'/>
<id>9511ac7d20b4fdd471039d7756a912f319111c8a</id>
<content type='text'>
While iterating the context (once), multiple sources can be dispatched.
So if we get a timeout and shortly after the weak-ref callback, then
we still need to honor the weak-ref.

In particular, because weak_ref.unref() is not safe to do after
the object was already destroyed. So we need to be correct about
tracking destruction.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
While iterating the context (once), multiple sources can be dispatched.
So if we get a timeout and shortly after the weak-ref callback, then
we still need to honor the weak-ref.

In particular, because weak_ref.unref() is not safe to do after
the object was already destroyed. So we need to be correct about
tracking destruction.
</pre>
</div>
</content>
</entry>
<entry>
<title>example: add python example for libnm, NMClient, GMainContext and async</title>
<updated>2022-07-05T16:36:01+00:00</updated>
<author>
<name>Thomas Haller</name>
<email>thaller@redhat.com</email>
</author>
<published>2022-06-30T21:55:03+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/NetworkManager.git/commit/?id=b3181cfbee0ba3f0cd757b9d9b851e61da3cd000'/>
<id>b3181cfbee0ba3f0cd757b9d9b851e61da3cd000</id>
<content type='text'>
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1290
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1290
</pre>
</div>
</content>
</entry>
<entry>
<title>feat: add example for wifi sae connection</title>
<updated>2022-06-16T07:40:55+00:00</updated>
<author>
<name>liaohanqin</name>
<email>liaohanqin@uniontech.com</email>
</author>
<published>2022-06-02T09:05:19+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/NetworkManager.git/commit/?id=5f530904de3ef0b52367bf58191b186d8da30cba'/>
<id>5f530904de3ef0b52367bf58191b186d8da30cba</id>
<content type='text'>
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1247
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1247
</pre>
</div>
</content>
</entry>
<entry>
<title>examples: reword comments in "30-anon.conf" snippet</title>
<updated>2022-05-27T13:05:03+00:00</updated>
<author>
<name>Thomas Haller</name>
<email>thaller@redhat.com</email>
</author>
<published>2022-05-27T13:03:44+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/NetworkManager.git/commit/?id=bc4d31730225d1749e5d0e88983b0826a32022db'/>
<id>bc4d31730225d1749e5d0e88983b0826a32022db</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>examples: improve finding last checkpoint in "checkpoint.py"</title>
<updated>2022-05-02T16:04:37+00:00</updated>
<author>
<name>Thomas Haller</name>
<email>thaller@redhat.com</email>
</author>
<published>2022-05-02T16:02:50+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/NetworkManager.git/commit/?id=3ce3ed4c92fb7d21da8f8c2f77b093fa71130455'/>
<id>3ce3ed4c92fb7d21da8f8c2f77b093fa71130455</id>
<content type='text'>
This is a python example. We should do nice things, like
using max() for finding the maximum, instead of sorting.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This is a python example. We should do nice things, like
using max() for finding the maximum, instead of sorting.
</pre>
</div>
</content>
</entry>
</feed>
