• R/O
  • SSH
  • HTTPS

bchan: 提交


Commit MetaInfo

修訂504 (tree)
時間2012-06-23 16:22:01
作者ornse01

Log Message

fix flag clear in not exist endpoint.

Change Summary

差異

--- bchanf/trunk/src/http/http_connector.c (revision 503)
+++ bchanf/trunk/src/http/http_connector.c (revision 504)
@@ -423,6 +423,37 @@
423423 return ret;
424424 }
425425
426+LOCAL Bool http_connector_isexistwaiting(http_connector_t *connector)
427+{
428+ http_reqentry_t *entry;
429+ http_recdictiterator_t iter;
430+ Bool cont, ret = False;
431+
432+ http_reqdictiterator_initialize(&iter, connector->dict);
433+ for (;;) {
434+ cont = http_reqdictiterator_next(&iter, &entry);
435+ if (cont == False) {
436+ break;
437+ }
438+ if (entry->status == WAITING_TRANSPORT) {
439+ ret = True;
440+ break;
441+ } else if (entry->status == SENDING_REQUEST) {
442+ ret = True;
443+ break;
444+ } else if (entry->status == WAITING_RESPONSE) {
445+ ret = True;
446+ break;
447+ } else if (entry->status == RECEIVING_RESPONSE) {
448+ ret = True;
449+ break;
450+ }
451+ }
452+ http_reqdictiterator_finalize(&iter);
453+
454+ return ret;
455+}
456+
426457 LOCAL W http_connector_waitreceiving(http_connector_t *connector, TMOUT tmout)
427458 {
428459 W ret = 0;
@@ -466,11 +497,11 @@
466497 EXPORT W http_connector_waitconnection(http_connector_t *connector, TMOUT tmout)
467498 {
468499 W err;
469- Bool evt = False;
500+ Bool evt = False, exist;
470501
471- err = wai_flg(connector->flg, HTTP_CONNECTOR_FLAG_REQUEST, WF_AND, tmout);
502+ err = wai_flg(connector->flg, HTTP_CONNECTOR_FLAG_REQUEST, WF_AND|NOCLR, tmout);
472503 if (err < 0) {
473- return 0;
504+ return err;
474505 }
475506
476507 HTTP_CONNECTOR_ENTER_CRITICAL_SECTION_RET_ERR(connector);
@@ -484,6 +515,11 @@
484515 }
485516 http_transport_releaseunusedendpoint(connector->transport);
486517
518+ exist = http_connector_isexistwaiting(connector);
519+ if (exist == False) {
520+ clr_flg(connector->flg, HTTP_CONNECTOR_FLAG_CLEARMASK_REQUEST);
521+ }
522+
487523 err = http_connector_waitreceiving(connector, tmout);
488524 HTTP_CONNECTOR_LEAVE_CRITICAL_SECTION(connector);
489525 if (err < 0) {
Show on old repository browser