libidav/session.c

changeset 49
2f71f4ee247a
parent 18
af411868ab9b
child 55
1ce14068ef31
equal deleted inserted replaced
48:ae61523bce20 49:2f71f4ee247a
29 #include <stdio.h> 29 #include <stdio.h>
30 #include <stdlib.h> 30 #include <stdlib.h>
31 #include <string.h> 31 #include <string.h>
32 32
33 #include <cx/buffer.h> 33 #include <cx/buffer.h>
34 #include <cx/utils.h>
35 #include <cx/mempool.h> 34 #include <cx/mempool.h>
36 #include <cx/hash_map.h> 35 #include <cx/hash_map.h>
37 36
38 #include "utils.h" 37 #include "utils.h"
39 #include "session.h" 38 #include "session.h"
117 DavSession* dav_session_clone(DavSession *sn) { 116 DavSession* dav_session_clone(DavSession *sn) {
118 CURL *newhandle = curl_easy_duphandle(sn->handle); 117 CURL *newhandle = curl_easy_duphandle(sn->handle);
119 118
120 DavSession *newsn = malloc(sizeof(DavSession)); 119 DavSession *newsn = malloc(sizeof(DavSession));
121 memset(newsn, 0, sizeof(DavSession)); 120 memset(newsn, 0, sizeof(DavSession));
122 newsn->mp = cxMempoolCreate(DAV_SESSION_MEMPOOL_SIZE, NULL); 121 newsn->mp = cxBasicMempoolCreate(DAV_SESSION_MEMPOOL_SIZE);
123 newsn->pathcache = cxHashMapCreate(sn->mp->allocator, CX_STORE_POINTERS, DAV_PATH_CACHE_SIZE); 122 newsn->pathcache = cxHashMapCreate(sn->mp->allocator, CX_STORE_POINTERS, DAV_PATH_CACHE_SIZE);
124 newsn->key = sn->key; 123 newsn->key = sn->key;
125 newsn->errorstr = NULL; 124 newsn->errorstr = NULL;
126 newsn->error = DAV_OK; 125 newsn->error = DAV_OK;
127 newsn->flags = 0; 126 newsn->flags = 0;
634 } 633 }
635 634
636 if(cxMapRemoveAndGet(locks->resource_locks, cx_hash_key_str(path))) { 635 if(cxMapRemoveAndGet(locks->resource_locks, cx_hash_key_str(path))) {
637 return; 636 return;
638 } 637 }
639 638
640 CxMutIterator i = cxListMutIterator(locks->collection_locks); 639 cxListFindRemove(locks->collection_locks, lock);
641 int rm = 0; 640 }
642 cx_foreach(DavLock* , cl, i) {
643 if(rm) {
644 break;
645 }
646 if(cl == lock) {
647 cxIteratorFlagRemoval(i);
648 rm = 1;
649 }
650 }
651 }

mercurial