diff options
author | Thomas Graf <tgraf@suug.ch> | 2011-07-14 10:51:49 +0200 |
---|---|---|
committer | Thomas Graf <tgraf@suug.ch> | 2011-07-14 10:51:49 +0200 |
commit | 21d52eabba00089e3319575616a429fb75309cb7 (patch) | |
tree | 90a89e99e2d631d2e6ad3ada665d9f16cd6d5361 /lib/cache.c | |
parent | dba0e91a09dcd928ebc4e8ce4db8cc6cd471d8f9 (diff) | |
download | libnl-21d52eabba00089e3319575616a429fb75309cb7.tar.gz |
Support for NLM_F_INTR
Check if a dump was interrupted and needs to be redone
Diffstat (limited to 'lib/cache.c')
-rw-r--r-- | lib/cache.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/lib/cache.c b/lib/cache.c index 7afa42e..3b453a9 100644 --- a/lib/cache.c +++ b/lib/cache.c @@ -677,6 +677,7 @@ int nl_cache_resync(struct nl_sock *sk, struct nl_cache *cache, NL_DBG(1, "Resyncing cache %p <%s>...\n", cache, nl_cache_name(cache)); +restart: /* Mark all objects so we can see if some of them are obsolete */ nl_cache_mark_all(cache); @@ -685,7 +686,9 @@ int nl_cache_resync(struct nl_sock *sk, struct nl_cache *cache, goto errout; err = __cache_pickup(sk, cache, &p); - if (err < 0) + if (err == -NLE_DUMP_INTR) + goto restart; + else if (err < 0) goto errout; nl_list_for_each_entry_safe(obj, next, &cache->c_items, ce_list) { @@ -770,6 +773,7 @@ int nl_cache_refill(struct nl_sock *sk, struct nl_cache *cache) { int err; +restart: err = nl_cache_request_full_dump(sk, cache); if (err < 0) return err; @@ -778,7 +782,13 @@ int nl_cache_refill(struct nl_sock *sk, struct nl_cache *cache) cache, nl_cache_name(cache)); nl_cache_clear(cache); - return nl_cache_pickup(sk, cache); + err = nl_cache_pickup(sk, cache); + if (err == -NLE_DUMP_INTR) { + fprintf(stderr, "dump interrupted, restarting!\n"); + goto restart; + } + + return err; } /** @} */ |