diff --git a/modules/csync_owncloud.c b/modules/csync_owncloud.c index 919957590..6de1eef14 100644 --- a/modules/csync_owncloud.c +++ b/modules/csync_owncloud.c @@ -1988,6 +1988,22 @@ static char *owncloud_error_string() return dav_session.error_string; } +static void owncloud_commit() { + SAFE_FREE( _lastDir ); + + clean_caches(); + + if( dav_session.ctx ) + ne_session_destroy( dav_session.ctx ); + /* DEBUG_WEBDAV( "********** vio_module_shutdown" ); */ + + ne_sock_exit(); + _connected = 0; /* triggers dav_connect to go through the whole neon setup */ + +} + + + static int owncloud_utimes(const char *uri, const struct timeval *times) { ne_proppatch_operation ops[2]; @@ -2099,7 +2115,9 @@ csync_vio_method_t _method = { .chown = owncloud_chown, .utimes = owncloud_utimes, .set_property = owncloud_set_property, - .get_error_string = owncloud_error_string + .get_error_string = owncloud_error_string, + .commit = owncloud_commit + }; csync_vio_method_t *vio_module_init(const char *method_name, const char *args, diff --git a/src/csync.c b/src/csync.c index 59e4de99c..fcd3344af 100644 --- a/src/csync.c +++ b/src/csync.c @@ -750,6 +750,8 @@ int csync_commit(CSYNC *ctx) { /* The other steps happen anyway, what else can we do? */ } + csync_vio_commit(ctx); + /* destroy the rbtrees */ if (c_rbtree_size(ctx->local.tree) > 0) { c_rbtree_destroy(ctx->local.tree, _tree_destructor); diff --git a/src/vio/csync_vio.c b/src/vio/csync_vio.c index fb4a48f7b..14ea29eac 100644 --- a/src/vio/csync_vio.c +++ b/src/vio/csync_vio.c @@ -653,16 +653,14 @@ int csync_vio_utimes(CSYNC *ctx, const char *uri, const struct timeval *times) { return rc; } -int csync_vio_set_property(CSYNC* ctx, const char* key, void* data) -{ +int csync_vio_set_property(CSYNC* ctx, const char* key, void* data) { int rc = -1; if(VIO_METHOD_HAS_FUNC(ctx->module.method, set_property)) rc = ctx->module.method->set_property(key, data); return rc; } -char *csync_vio_get_error_string(CSYNC *ctx) -{ +char *csync_vio_get_error_string(CSYNC *ctx) { if(ctx->error_string) { return ctx->error_string; } @@ -672,3 +670,8 @@ char *csync_vio_get_error_string(CSYNC *ctx) } return NULL; } + +void csync_vio_commit(CSYNC *ctx) { + if(VIO_METHOD_HAS_FUNC(ctx->module.method, commit)) + ctx->module.method->commit(); +} diff --git a/src/vio/csync_vio.h b/src/vio/csync_vio.h index b672fbfdd..c840999c3 100644 --- a/src/vio/csync_vio.h +++ b/src/vio/csync_vio.h @@ -67,4 +67,6 @@ int csync_vio_set_property(CSYNC *ctx, const char *key, void *data); char *csync_vio_get_error_string(CSYNC *ctx); +void csync_vio_commit(CSYNC *ctx); + #endif /* _CSYNC_VIO_H */ diff --git a/src/vio/csync_vio_method.h b/src/vio/csync_vio_method.h index 243beaafa..5516b6dab 100644 --- a/src/vio/csync_vio_method.h +++ b/src/vio/csync_vio_method.h @@ -81,6 +81,7 @@ typedef int (*csync_method_utimes_fn)(const char *uri, const struct timeval time typedef int (*csync_method_set_property_fn)(const char *key, void *data); typedef char* (*csync_method_get_error_string_fn)(); +typedef void (*csync_method_commit_fn)(); struct csync_vio_method_s { size_t method_table_size; /* Used for versioning */ @@ -106,6 +107,7 @@ struct csync_vio_method_s { csync_method_sendfile_fn sendfile; csync_method_set_property_fn set_property; csync_method_get_error_string_fn get_error_string; + csync_method_commit_fn commit; }; #endif /* _CSYNC_VIO_H */