Changeset b4a875b in mod_gnutls
- Timestamp:
- Jul 8, 2011, 4:55:17 PM (12 years ago)
- Branches:
- asyncio, debian/master, debian/stretch-backports, jessie-backports, master, msva, proxy-ticket, upstream
- Children:
- 60cf11c
- Parents:
- b59327c
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/gnutls_io.c
rb59327c rb4a875b 542 542 { 543 543 apr_size_t ret; 544 apr_bucket *e;545 544 mgs_handle_t *ctxt = (mgs_handle_t *) f->ctx; 546 545 apr_status_t status = APR_SUCCESS; … … 563 562 apr_bucket *bucket = APR_BRIGADE_FIRST(bb); 564 563 565 if (AP_BUCKET_IS_EOC(bucket)) { 566 if (ctxt->session != NULL) { 567 do { 568 ret = 569 gnutls_bye(ctxt->session, 570 GNUTLS_SHUT_WR); 571 } while (ret == GNUTLS_E_INTERRUPTED 572 || ret == GNUTLS_E_AGAIN); 573 } 574 575 apr_bucket_copy(bucket, &e); 576 APR_BRIGADE_INSERT_TAIL(ctxt->output_bb, e); 577 578 if ((status = 579 ap_pass_brigade(f->next, 580 ctxt->output_bb)) != 581 APR_SUCCESS) { 582 apr_brigade_cleanup(ctxt->output_bb); 583 return status; 584 } 585 586 apr_brigade_cleanup(ctxt->output_bb); 587 if (ctxt->session) { 588 gnutls_deinit(ctxt->session); 589 ctxt->session = NULL; 590 } 591 continue; 592 } else if (APR_BUCKET_IS_FLUSH(bucket) 593 || APR_BUCKET_IS_EOS(bucket)) { 594 595 apr_bucket_copy(bucket, &e); 596 APR_BRIGADE_INSERT_TAIL(ctxt->output_bb, e); 597 if ((status = 598 ap_pass_brigade(f->next, 599 bb)) != APR_SUCCESS) { 600 apr_brigade_cleanup(ctxt->output_bb); 601 return status; 602 } 603 604 apr_brigade_cleanup(ctxt->output_bb); 605 continue; 606 } else { 564 if (AP_BUCKET_IS_EOS(bucket)) { 565 return ap_pass_brigade(f->next, bb); 566 } else if (APR_BUCKET_IS_FLUSH(bucket)) { 567 /* Try Flush */ 568 if( write_flush(ctxt) < 0) { 569 /* Flush Error */ 570 return ctxt->output_rc; 571 } 572 /* cleanup! */ 573 apr_bucket_delete(bucket); 574 } else if (AP_BUCKET_IS_EOC(bucket)) { 575 /* End Of Connection */ 576 if (ctxt->session != NULL) { 577 /* Try A Clean Shutdown */ 578 do { 579 ret = gnutls_bye( ctxt->session, 580 GNUTLS_SHUT_WR); 581 } while(ret == GNUTLS_E_INTERRUPTED || 582 ret == GNUTLS_E_AGAIN); 583 /* De-Initialize Session */ 584 gnutls_deinit(ctxt->session); 585 ctxt->session = NULL; 586 } 587 /* Pass next brigade! */ 588 return ap_pass_brigade(f->next, bb); 589 } else { 607 590 /* filter output */ 608 591 const char *data; … … 613 596 614 597 if (APR_STATUS_IS_EAGAIN(status)) { 615 rblock = APR_BLOCK_READ; 616 continue; /* and try again with a blocking read. */ 598 /* No data available so Flush! */ 599 if (write_flush(ctxt) < 0) { 600 return ctxt->output_rc; 601 } 602 /* Try again with a blocking read. */ 603 rblock = APR_BLOCK_READ; 604 continue; 617 605 } 618 606 … … 621 609 if (!APR_STATUS_IS_EOF(status) 622 610 && (status != APR_SUCCESS)) { 623 break;611 return status; 624 612 } 625 613 … … 652 640 ctxt->output_rc = 653 641 APR_EGENERAL; 642 return ctxt->output_rc; 654 643 } 655 644 } else if (ret != len) { … … 661 650 662 651 apr_bucket_delete(bucket); 663 664 if (ctxt->output_rc != APR_SUCCESS) {665 break;666 }667 652 } 668 653 }
Note: See TracChangeset
for help on using the changeset viewer.