/* setup communication channel */
backend.ctx->set_bpipe(bp);
DMSG(ctx, DINFO, "Backend executed at PID=%i\n", bp->worker_pid);
+
+ backend.ctx->set_timeout(BACKEND_TIMEOUT);
+ DMSG(ctx, DINFO, "setup backend timeout=%d\n", backend.ctx->get_timeout());
+
return bRC_OK;
}
extern const bool ACCURATEPLUGINPARAMETER; /// accurate parameter for plugin parameter
extern const int ADDINCLUDESTRIPOPTION; /// setup precompiled include path strip option
extern const bool DONOTSAVE_FT_PLUGIN_CONFIG; /// when set to `true` then Metaplugin won't save FT_PLUGIN_CONFIG as a first file during Full backup
+extern const uint32_t BACKEND_TIMEOUT; /// define a custom timeout value in seconds for data exchange (read from or write to backend)
/// defines if metaplugin should handle local filesystem restore with Bacula Core functions
/// `false` means metaplugin will redirect local restore to backend
int rbytes = 0;
struct timeval _timeout;
- _timeout.tv_sec = PTCOMM_DEFAULT_TIMEOUT;
+ _timeout.tv_sec = m_timeout > 0 ? m_timeout : PTCOMM_DEFAULT_TIMEOUT;
_timeout.tv_usec = 0;
while (nbytes > 0)
*/
inline bool is_abort_on_error() { return abort_on_error; }
- inline void set_timeout(uint32_t timeout) { m_timeout = timeout; }
+ /**
+ * @brief Set the timeout value in seconds
+ *
+ * @param timeout a value in seconds
+ */
+ inline void set_timeout(uint32_t timeout) { m_timeout = timeout > 0 ? timeout : PTCOMM_DEFAULT_TIMEOUT; }
+
+ /**
+ * @brief Get the timeout object
+ *
+ * @return uint32_t a current value of the PTCOMM Timeout
+ */
+ inline uint32_t get_timeout() { return m_timeout; }
};
#endif /* _PTCOMM_H_ */