diff options
-rw-r--r-- | netfs/fuse/fuseAppBase.h | 29 |
1 files changed, 18 insertions, 11 deletions
diff --git a/netfs/fuse/fuseAppBase.h b/netfs/fuse/fuseAppBase.h index b044f99..63763d9 100644 --- a/netfs/fuse/fuseAppBase.h +++ b/netfs/fuse/fuseAppBase.h @@ -149,18 +149,25 @@ class DLL_PUBLIC FuseAppBase { template <int (FuseAppBase::*f)(Args...)> static int helper(Args ... a) { - try { - return (fuseApp->*f)(a...); - } - catch (const std::exception & ex) { - if (int rtn = fuseApp->onError(ex)) { - return rtn; + for (int t = 0; ; ++t) { + try { + return (fuseApp->*f)(a...); + } + catch (const std::exception & ex) { + if (t < 10) { + if (int rtn = fuseApp->onError(ex)) { + return rtn; + } + } + else { + fuseApp->logf(LOG_ERR, "Retries expired with %s calling %s", ex.what(), typeid(f).name()); + return -EIO; + } + } + catch (...) { + fuseApp->logf(LOG_ERR, "Unknown exception calling %s", typeid(f).name()); + return -EIO; } - return helper<f>(a...); - } - catch (...) { - fuseApp->logf(LOG_ERR, "Unknown exception calling %s", typeid(f).name()); - return -EIO; } } }; |