Просмотр исходного кода

more fix for r released in read_event_handler

tags/v0.4
Brice Figureau 18 лет назад
Родитель
Сommit
ebcfb5a21f
1 измененных файлов: 6 добавлений и 4 удалений
  1. 6
    4
      ngx_http_uploadprogress_module.c

+ 6
- 4
ngx_http_uploadprogress_module.c Просмотреть файл

309
     ngx_str_t                                   *id;
309
     ngx_str_t                                   *id;
310
     ngx_slab_pool_t                             *shpool;
310
     ngx_slab_pool_t                             *shpool;
311
     ngx_connection_t                            *c;
311
     ngx_connection_t                            *c;
312
+    ngx_shm_zone_t                              *shm_zone;
312
     ngx_http_uploadprogress_ctx_t               *ctx;
313
     ngx_http_uploadprogress_ctx_t               *ctx;
313
     ngx_http_uploadprogress_node_t              *up;
314
     ngx_http_uploadprogress_node_t              *up;
314
     ngx_http_uploadprogress_conf_t              *upcf;
315
     ngx_http_uploadprogress_conf_t              *upcf;
327
     ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
328
     ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
328
                    "upload-progress: read_event_handler found id: %V", id);
329
                    "upload-progress: read_event_handler found id: %V", id);
329
     upcf = ngx_http_get_module_loc_conf(r, ngx_http_uploadprogress_module);
330
     upcf = ngx_http_get_module_loc_conf(r, ngx_http_uploadprogress_module);
331
+    shm_zone = upcf->shm_zone;
330
     
332
     
331
     /* call the original read event handler */
333
     /* call the original read event handler */
332
     module_ctx = ngx_http_get_module_ctx(r, ngx_http_uploadprogress_module);
334
     module_ctx = ngx_http_get_module_ctx(r, ngx_http_uploadprogress_module);
335
     /* at this stage, r is not anymore safe to use */
337
     /* at this stage, r is not anymore safe to use */
336
     /* the request could have been closed/freed behind our back */
338
     /* the request could have been closed/freed behind our back */
337
     /* and thats the same issue with any other material that was allocated in the request pool */
339
     /* and thats the same issue with any other material that was allocated in the request pool */
338
-    /* like id for instance... */
340
+    /* that's why we duplicate id afterward */
339
 
341
 
340
     if (id == NULL) {
342
     if (id == NULL) {
341
         ngx_log_debug0(NGX_LOG_DEBUG_HTTP, ngx_cycle->log, 0,
343
         ngx_log_debug0(NGX_LOG_DEBUG_HTTP, ngx_cycle->log, 0,
343
         return;
345
         return;
344
     }
346
     }
345
 
347
 
346
-    if (upcf->shm_zone == NULL) {
348
+    if (shm_zone == NULL) {
347
         ngx_http_uploadprogress_strdupfree(id);
349
         ngx_http_uploadprogress_strdupfree(id);
348
         ngx_log_debug1(NGX_LOG_DEBUG_HTTP, ngx_cycle->log, 0,
350
         ngx_log_debug1(NGX_LOG_DEBUG_HTTP, ngx_cycle->log, 0,
349
                        "upload-progress: read_event_handler no shm_zone for id: %V", id);
351
                        "upload-progress: read_event_handler no shm_zone for id: %V", id);
350
         return;
352
         return;
351
     }
353
     }
352
 
354
 
353
-    ctx = upcf->shm_zone->data;
355
+    ctx = shm_zone->data;
354
 
356
 
355
     /* get the original connection of the upload */
357
     /* get the original connection of the upload */
356
-    shpool = (ngx_slab_pool_t *) upcf->shm_zone->shm.addr;
358
+    shpool = (ngx_slab_pool_t *) shm_zone->shm.addr;
357
 
359
 
358
     ngx_shmtx_lock(&shpool->mutex);
360
     ngx_shmtx_lock(&shpool->mutex);
359
 
361
 

Загрузка…
Отмена
Сохранить