Browse Source

timed out connections now errors instead of 0/0 and done on cleaning

tags/v0.4
Brice Figureau 18 years ago
parent
commit
51262f2755
1 changed files with 20 additions and 1 deletions
  1. 20
    1
      ngx_http_uploadprogress_module.c

+ 20
- 1
ngx_http_uploadprogress_module.c View File

271
     rc = upcf->handler(r);
271
     rc = upcf->handler(r);
272
 
272
 
273
     /* bail out if error */
273
     /* bail out if error */
274
-    if (rc >= NGX_HTTP_SPECIAL_RESPONSE)
274
+    if (rc >= NGX_HTTP_SPECIAL_RESPONSE) {
275
       return rc;
275
       return rc;
276
+    }
276
     
277
     
277
     /* request is OK, hijack the read_event_handler */
278
     /* request is OK, hijack the read_event_handler */
278
     ctx = ngx_pcalloc(r->pool, sizeof(ngx_http_uploadprogress_module_ctx_t));
279
     ctx = ngx_pcalloc(r->pool, sizeof(ngx_http_uploadprogress_module_ctx_t));
305
 
306
 
306
     /* check that the request/connection is still OK */
307
     /* check that the request/connection is still OK */
307
     if (r->headers_out.status >= NGX_HTTP_SPECIAL_RESPONSE) {
308
     if (r->headers_out.status >= NGX_HTTP_SPECIAL_RESPONSE) {
309
+        /* should mark up as error */
310
+        id = get_tracking_id(r);
311
+        if (id != NULL) {
312
+            upcf = ngx_http_get_module_loc_conf(r, ngx_http_uploadprogress_module);
313
+            if (upcf != NULL && upcf->shm_zone != NULL) {
314
+                ctx = upcf->shm_zone->data;
315
+
316
+                /* get the original connection of the upload */
317
+                shpool = (ngx_slab_pool_t *) upcf->shm_zone->shm.addr;
318
+
319
+                ngx_shmtx_lock(&shpool->mutex);
320
+                up = find_node(id, ctx, ngx_cycle->log);
321
+                if (up != NULL) {
322
+                    up->err_status = r->headers_out.status;
323
+                }
324
+                ngx_shmtx_unlock(&shpool->mutex);
325
+            }
326
+        }
308
         return;
327
         return;
309
     }
328
     }
310
 
329
 

Loading…
Cancel
Save