This is an automated email from the git hooks/post-receive script. x2go pushed a commit to branch master in repository x2gokdrive. commit 06bfff85073921415c2f1db03eb973455be9458e Author: Oleksandr Shneyder <o.shneyder@phoca-gmbh.de> Date: Tue Sep 14 13:57:45 2021 +0200 improve clearing of the frame list. --- debian/changelog | 1 + x2gokdriveremote.c | 13 ++++++++----- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/debian/changelog b/debian/changelog index 521ae99..3e17efc 100644 --- a/debian/changelog +++ b/debian/changelog @@ -25,6 +25,7 @@ x2gokdrive (0.0.0.1-0x2go1) UNRELEASED; urgency=medium - (re)enable sessions debugging. - fix infinite loop if reading of cookie has failed. - improve initialization of cursor frame and cache element structures. + - improve clearing of the frame list. [ Mihai Moldovan ] * Initial release: diff --git a/x2gokdriveremote.c b/x2gokdriveremote.c index 2cdc104..4125dcd 100644 --- a/x2gokdriveremote.c +++ b/x2gokdriveremote.c @@ -1703,13 +1703,15 @@ void clear_send_queue(void) */ void clear_frame_cache(uint32_t max_elements) { -// EPHYR_DBG("cache elements %d, cache size %lu\n",cache_elements, cache_size); - while(remoteVars.first_cache_element && remoteVars.cache_elements > max_elements) +// EPHYR_DBG("cache elements %d, cache size %lu, reducing to size: %d\n", remoteVars.cache_elements, remoteVars.cache_size, max_elements); + while(remoteVars.first_cache_element && (remoteVars.cache_elements > max_elements)) { struct cache_elem* next = NULL; - /* don't delete it now, return to it later */ - if(remoteVars.first_cache_element->busy) + /* don't delete it now, return to it later + * but if max_elements is 0 we are clearing all elements + */ + if(remoteVars.first_cache_element->busy && max_elements) { EPHYR_DBG("%x - is busy (%d), not deleting", remoteVars.first_cache_element->crc, remoteVars.first_cache_element->busy); return; @@ -1721,7 +1723,8 @@ void clear_frame_cache(uint32_t max_elements) remoteVars.cache_size-=remoteVars.first_cache_element->size; } - if(remoteVars.client_connected) + //add element to deleted list if client is connected and we are not deleting all frame list + if(remoteVars.client_connected && max_elements) { /* add deleted element to the list for sending */ struct deleted_elem* delem=malloc(sizeof(struct deleted_elem)); -- Alioth's /home/x2go-admin/maintenancescripts/git/hooks/post-receive-email on /srv/git/code.x2go.org/x2gokdrive.git