Skip to content

Commit 0efe176

Browse files
author
Ivan Stoev
committed
Merge branch 'master' of gitlab.pcloud.com:pcloud/synclib
2 parents ff8f79a + c5d93f3 commit 0efe176

File tree

5 files changed

+21
-20
lines changed

5 files changed

+21
-20
lines changed

plocalscan.c

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -638,15 +638,16 @@ static void scan_delete_folder(sync_folderlist *fl){
638638
psync_sql_bind_uint(res, 1, fl->syncid);
639639
psync_sql_bind_uint(res, 2, fl->localid);
640640
psync_sql_run_free(res);
641-
return;
642641
}
643-
psync_sql_commit_transaction();
644-
if (tries==10)
645-
psync_timer_notify_exception();
646-
tries++;
647-
psync_milisleep(20+tries*20);
648-
psync_sql_start_transaction();
649-
goto retry;
642+
else{
643+
psync_sql_commit_transaction();
644+
if (tries==10)
645+
psync_timer_notify_exception();
646+
tries++;
647+
psync_milisleep(20+tries*20);
648+
psync_sql_start_transaction();
649+
goto retry;
650+
}
650651
}
651652
delete_local_folder_rec(fl->localid);
652653
if (folderid)

ppathstatus.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -146,9 +146,9 @@ void psync_path_status_init() {
146146
psync_list_add_tail(&parent_cache_lru, &parent_cache_entries[i].list_lru);
147147
psync_list_add_tail(&cache_free, &parent_cache_entries[i].list_hash);
148148
}
149-
psync_tree_for_each_element_call(folder_tasks, folder_tasks_t, tree, psync_free);
149+
psync_tree_for_each_element_call_safe(folder_tasks, folder_tasks_t, tree, psync_free);
150150
folder_tasks=PSYNC_TREE_EMPTY;
151-
psync_tree_for_each_element_call(sync_data, sync_data_t, tree, sync_data_free);
151+
psync_tree_for_each_element_call_safe(sync_data, sync_data_t, tree, sync_data_free);
152152
sync_data=PSYNC_TREE_EMPTY;
153153
psync_path_status_reload_syncs();
154154
psync_path_status_clear_path_cache();

psynclib.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1575,8 +1575,8 @@ int psync_upload_data(psync_folderid_t folderid, const char *remote_filename, co
15751575
return psync_upload_params(params, ARRAY_SIZE(params), data, length, fileid);
15761576
}
15771577

1578-
int psync_upload_data_as(const char *remote_path, const void *data, size_t length, psync_fileid_t *fileid){
1579-
binparam params[]={P_STR("auth", psync_my_auth), P_STR("path", remote_path), P_BOOL("nopartial", 1)};
1578+
int psync_upload_data_as(const char *remote_path, const char *remote_filename, const void *data, size_t length, psync_fileid_t *fileid){
1579+
binparam params[]={P_STR("auth", psync_my_auth), P_STR("path", remote_path), P_STR("filename", remote_filename), P_BOOL("nopartial", 1)};
15801580
return psync_upload_params(params, ARRAY_SIZE(params), data, length, fileid);
15811581
}
15821582

@@ -1630,13 +1630,13 @@ int psync_upload_file(psync_folderid_t folderid, const char *remote_filename, co
16301630
return ret;
16311631
}
16321632

1633-
int psync_upload_file_as(const char *remote_path, const char *local_path, psync_fileid_t *fileid){
1633+
int psync_upload_file_as(const char *remote_path, const char *remote_filename, const char *local_path, psync_fileid_t *fileid){
16341634
char *data;
16351635
size_t length;
16361636
int ret;
16371637
if (psync_load_file(local_path, &data, &length))
16381638
return -2;
1639-
ret=psync_upload_data_as(remote_path, data, length, fileid);
1639+
ret=psync_upload_data_as(remote_path, remote_filename, data, length, fileid);
16401640
psync_free(data);
16411641
return ret;
16421642
}

psynclib.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -934,9 +934,9 @@ void psync_run_new_version(psync_new_version_t *ver);
934934
*/
935935

936936
int psync_upload_data(psync_folderid_t folderid, const char *remote_filename, const void *data, size_t length, psync_fileid_t *fileid);
937-
int psync_upload_data_as(const char *remote_path, const void *data, size_t length, psync_fileid_t *fileid);
937+
int psync_upload_data_as(const char *remote_path, const char *remote_filename, const void *data, size_t length, psync_fileid_t *fileid);
938938
int psync_upload_file(psync_folderid_t folderid, const char *remote_filename, const char *local_path, psync_fileid_t *fileid);
939-
int psync_upload_file_as(const char *remote_path, const char *local_path, psync_fileid_t *fileid);
939+
int psync_upload_file_as(const char *remote_path, const char *remote_filename, const char *local_path, psync_fileid_t *fileid);
940940

941941
/* Filesystem functions.
942942
*

ptimer.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/* Copyright (c) 2013-2014 Anton Titov.
22
* Copyright (c) 2013-2014 pCloud Ltd.
33
* All rights reserved.
4-
*
4+
*
55
* Redistribution and use in source and binary forms, with or without
66
* modification, are permitted provided that the following conditions are met:
77
* * Redistributions of source code must retain the above copyright
@@ -12,7 +12,7 @@
1212
* * Neither the name of pCloud Ltd nor the
1313
* names of its contributors may be used to endorse or promote products
1414
* derived from this software without specific prior written permission.
15-
*
15+
*
1616
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
1717
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
1818
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
@@ -36,7 +36,7 @@
3636
* (it is log TIMER_ARRAY_SIZE(timer_seconds_after_now)). So servicing a timer is
3737
* generally constant time task with a maximum constant of TIMER_LEVELS and increasing
3838
* TIMER_ARRAY_SIZE will trade memory for less processing for each timer.
39-
*
39+
*
4040
* TIMER_ARRAY_SIZE should be a power of two.
4141
*/
4242

@@ -139,7 +139,7 @@ static void timer_thread(){
139139
pthread_mutex_unlock(&timer_mutex);
140140
if (unlikely(!psync_list_isempty(&timers)))
141141
timer_process_timers(&timers);
142-
if (unlikely(psync_current_time-lt>=20))
142+
if (unlikely(psync_current_time-lt>=25))
143143
timer_sleep_detected(lt);
144144
else if (unlikely_log(psync_current_time==lt)){
145145
if (!psync_do_run)

0 commit comments

Comments
 (0)