• R/O
  • HTTP
  • SSH
  • HTTPS

ultramonkey-l7-v2: コミット

UltraMonkey-L7 V2(single-thread implementation)


コミットメタ情報

リビジョンfce439e56f60696e8771d10a9dc4f40c1247cac0 (tree)
日時2010-06-07 02:37:17
作者Kohei TANUMA <tanuma@user...>
コミッターKohei TANUMA

ログメッセージ

Set old destination for changing connection from sorry server to real server.
Fix the following pattern (a) and (b), but not (c).
(a) 1. First connection: sorry server (over max connections)

    1. Communicate to sorry server...
    2. Some other connections done. (below max connections)
    3. Change connection: sorry -> real server

(b) 1. First connection: sorry server (force-sorry-flag is on)

    1. Communicate to sorry server...
    2. Administrator change setting (force-sorry-flag is off)
    3. Change connection: sorry -> real server

(c) 1. First connection: sorry server (no real servers)

    1. Communicate to sorry server...
    2. Administrator add real servers
    3. Change connection: sorry -> real server
      (But now connection will be closed.)

変更サマリ

差分

--- a/src/conn.c
+++ b/src/conn.c
@@ -1060,14 +1060,17 @@ l7vs_conn_is_rs_connected(struct l7vs_iomux *iom, struct l7vs_conn *conn, struct
10601060 }
10611061 /*------ DEBUG LOG END ------*/
10621062
1063- //is real server connected?
10641063 if (-1 != conn->riom->fd) {
1065- // check sorry status of service
1066- // argment 0 means no connection count check
1064+ // Connection to real/sorry server is already ESTABLISHED
1065+
1066+ // Check force-sorry-flag and existance of real servers
10671067 sorry_state = l7vs_sched_sorry_check(conn->srv, 0);
10681068 if (sorry_state) {
1069- // check connect to sorry-server now
1069+ // force-sorry-flag is ON or no real servers
1070+
10701071 if (!conn->sorry_conn_flag) {
1072+ // Current connection is to real server,
1073+ // so change to connect to sorry server.
10711074 // get sorry-server destination (argment 0)
10721075 d = l7vs_sched_sorry_dest(conn->srv, conn, 0);
10731076 /*-------- DEBUG LOG --------*/
@@ -1132,9 +1135,17 @@ l7vs_conn_is_rs_connected(struct l7vs_iomux *iom, struct l7vs_conn *conn, struct
11321135 }
11331136 conn->sorry_conn_flag = 1;
11341137 }
1138+ else {
1139+ // Current connection is already changed to sorry server,
1140+ // so do nothing.
1141+ }
1142+
11351143 } else {
1136- // check connect to sorry-server now
1144+ // force-sorry-flag is OFF and real servers exist
1145+
11371146 if (conn->sorry_conn_flag) {
1147+ // Current connection is to sorry server,
1148+ // so change to connect to real server.
11381149 // get old real-server destination (argment 1)
11391150 d = l7vs_sched_sorry_dest(conn->srv, conn, 1);
11401151 /*-------- DEBUG LOG --------*/
--- a/src/lsock.c
+++ b/src/lsock.c
@@ -492,6 +492,7 @@ l7vs_lsock_select_service(struct l7vs_lsock *lsock,
492492 if (ret == 0) {
493493 // check sorry status if ret == 0
494494 // sorry_check argument 1 means check connection count
495+ // Check the connection count(--upper, maxconn)
495496 if (l7vs_sched_sorry_check(srv, 1)) {
496497 if (!sorry_save) {
497498 // save sorry dest to xxx_tmp only first time
@@ -517,6 +518,7 @@ l7vs_lsock_select_service(struct l7vs_lsock *lsock,
517518 }
518519 }
519520 // when select_dest NG
521+ // No suitable realservers exist
520522 if (!sorry_save2) {
521523 // save sorry dest to xxx_tmp2 only first time
522524 srv_tmp2 = srv;
@@ -528,10 +530,10 @@ l7vs_lsock_select_service(struct l7vs_lsock *lsock,
528530 l = g_list_next(l);
529531 }
530532
533+ // Over maximum connections
531534 if (sorry_save) {
532535 // saved sorry dest is exist
533536 // set sorry-server destination
534- //*dest_ret = (struct l7vs_dest *)l7vs_sched_sorry_dest(srv_tmp, NULL, 1);
535537 *dest_ret = (struct l7vs_dest *)l7vs_sched_sorry_dest(srv_tmp, NULL, 0);
536538 if (!*dest_ret) {
537539 LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSD_SORRY_SERVER,2, "sorry-server dest is NULL");
@@ -542,13 +544,15 @@ l7vs_lsock_select_service(struct l7vs_lsock *lsock,
542544 return -1;
543545 }
544546 *srv_ret = srv_tmp;
547+ conn->old_dest = dest_tmp;
545548 conn->cldata_len = len_tmp;
546549 conn->sorry_conn_flag = 1;
547550 val = 1;
551+
552+ // No suitable realservers exist
548553 } else if (sorry_save2) {
549554 // saved sorry dest2 is exist
550555 // set sorry-server destination
551- //*dest_ret = (struct l7vs_dest *)l7vs_sched_sorry_dest(srv_tmp2, NULL, 1);
552556 *dest_ret = (struct l7vs_dest *)l7vs_sched_sorry_dest(srv_tmp2, NULL, 0);
553557 if (!*dest_ret) {
554558 LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSD_SORRY_SERVER,3, "sorry-server dest is NULL");
@@ -559,6 +563,7 @@ l7vs_lsock_select_service(struct l7vs_lsock *lsock,
559563 return -1;
560564 }
561565 *srv_ret = srv_tmp2;
566+ conn->old_dest = dest_tmp2;
562567 conn->cldata_len = len_tmp2;
563568 conn->sorry_conn_flag = 1;
564569 val = 1;
旧リポジトリブラウザで表示