Переглянути джерело

More debug to find the root cause of issue #7

wip/issue7_chasing
Brice Figureau 15 роки тому
джерело
коміт
83250cb92b
1 змінених файлів з 17 додано та 30 видалено
  1. 17
    30
      ngx_http_uploadprogress_module.c

+ 17
- 30
ngx_http_uploadprogress_module.c Переглянути файл

@@ -917,54 +917,36 @@ ngx_http_uploadprogress_rbtree_insert_value(ngx_rbtree_node_t * temp,
917 917
                                             ngx_rbtree_node_t * node,
918 918
                                             ngx_rbtree_node_t * sentinel)
919 919
 {
920
+    ngx_rbtree_node_t              **p;
920 921
     ngx_http_uploadprogress_node_t  *upn, *upnt;
921 922
 
922 923
     for (;;) {
923 924
 
924 925
         if (node->key < temp->key) {
925 926
 
926
-            if (temp->left == sentinel) {
927
-                temp->left = node;
928
-                break;
929
-            }
930
-
931
-            temp = temp->left;
927
+            p = &temp->left;
932 928
 
933 929
         } else if (node->key > temp->key) {
934 930
 
935
-            if (temp->right == sentinel) {
936
-                temp->right = node;
937
-                break;
938
-            }
939
-
940
-            temp = temp->right;
931
+            p = &temp->right;
941 932
 
942
-        } else {                /* node->key == temp->key */
933
+        } else { /* node->key == temp->key */
943 934
 
944 935
             upn = (ngx_http_uploadprogress_node_t *) node;
945 936
             upnt = (ngx_http_uploadprogress_node_t *) temp;
946 937
 
947
-            if (ngx_memn2cmp(upn->data, upnt->data, upn->len, upnt->len) < 0) {
948
-
949
-                if (temp->left == sentinel) {
950
-                    temp->left = node;
951
-                    break;
952
-                }
953
-
954
-                temp = temp->left;
955
-
956
-            } else {
957
-
958
-                if (temp->right == sentinel) {
959
-                    temp->right = node;
960
-                    break;
961
-                }
938
+            p = (ngx_memn2cmp(upn->data, upnt->data, upn->len, upnt->len) < 0)
939
+                ? &temp->left : &temp->right;
940
+        }
962 941
 
963
-                temp = temp->right;
964
-            }
942
+        if (*p == sentinel) {
943
+            break;
965 944
         }
945
+
946
+        temp = *p;
966 947
     }
967 948
 
949
+    *p = node;
968 950
     node->parent = temp;
969 951
     node->left = sentinel;
970 952
     node->right = sentinel;
@@ -1216,6 +1198,9 @@ ngx_http_uploadprogress_errortracker(ngx_http_request_t * r)
1216 1198
         ctx->list_head.next = up;
1217 1199
 
1218 1200
         ngx_rbtree_insert(ctx->rbtree, node);
1201
+        
1202
+        ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
1203
+                       "trackuploads error-tracking: %08XD inserted in rbtree", hash);
1219 1204
 
1220 1205
         /* start the timer if needed */
1221 1206
         if (!upcf->cleanup.timer_set) {
@@ -1225,6 +1210,8 @@ ngx_http_uploadprogress_errortracker(ngx_http_request_t * r)
1225 1210
             ngx_add_timer(&upcf->cleanup, TIMER_FREQUENCY);
1226 1211
         }
1227 1212
 
1213
+        log_rbtree(ctx,r->connection->log);
1214
+
1228 1215
         ngx_shmtx_unlock(&shpool->mutex);
1229 1216
 
1230 1217
         cln->handler = ngx_http_uploadprogress_cleanup;

Завантаження…
Відмінити
Зберегти