Grid Community Toolkit  6.2.1653033972 (tag: v6.2.20220524)
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
globus_ftp_client_restart_plugin.example

The following example illustrates a typical use of the restart plugin. In this case, we configure a plugin instance to restart the operation for up to an hour, using an exponential back-off between retries.

#include "globus_time.h"
int
main(int argc, char *argv[])
{
globus_abstime_t deadline;
/* Set a deadline to be now + 1 hour */
GlobusAbstimeSet(deadline, 60 * 60, 0);
/* initialize a plugin with this deadline */
&restart_plugin,
0, /* # retry limit (0 means don't limit) */
GLOBUS_NULL, /* interval between retries--null means
* exponential backoff
*/
&deadline);
/* Set up our handle to use the new plugin */
globus_ftp_client_handleattr_add_plugin(&handleattr, &restart_plugin);
globus_ftp_client_handle_init(&handle, &handleattr);
/*
* Now, if a fault occurs processing this get, the plugin will restart
* it with an exponential back-off, and will bail if a fault occurs
* after 1 hour of retrying
*/
"ftp://ftp.globus.org/pub/globus/README",
callback_fn,
}