Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactoring #109

Open
wants to merge 10 commits into
base: master
Choose a base branch
from
5 changes: 4 additions & 1 deletion direct.c
Original file line number Diff line number Diff line change
Expand Up @@ -258,8 +258,9 @@ rr_data_t direct_request(void *cdata, rr_data_const_t request) {
rsocket[1] = wsocket[0] = &sd;

conn_alive = 0;
loop = 0; // 0 = request from client; 1 = response from server

for (loop = 0; loop < 2; ++loop) {
while (loop < 2) {
if (data[loop]->empty) { // Isn't this the first loop with request supplied by caller?
if (debug) {
printf("\n******* Round %d C: %d, S: %d *******\n", loop+1, cd, sd);
Expand Down Expand Up @@ -501,6 +502,8 @@ rr_data_t direct_request(void *cdata, rr_data_const_t request) {
goto bailout;
}
}

++loop;
fralken marked this conversation as resolved.
Show resolved Hide resolved
}

free_rr_data(&data[0]);
Expand Down
5 changes: 4 additions & 1 deletion forward.c
Original file line number Diff line number Diff line change
Expand Up @@ -187,8 +187,9 @@ rr_data_t forward_request(void *thread_data, rr_data_t request) {
retry = 0;
proxy_alive = 0;
conn_alive = 0;
loop = 0; // 0 = request from client; 1 = response from server

for (loop = 0; loop < 2; ++loop) {
while (loop < 2) {
if (data[loop]->empty) { // Isn't this the first loop with request supplied by caller?
if (debug) {
printf("\n******* Round %d C: %d, S: %d (authok=%d, noauth=%d) *******\n", loop+1, cd, sd, authok, noauth);
Expand Down Expand Up @@ -462,6 +463,8 @@ rr_data_t forward_request(void *thread_data, rr_data_t request) {
rc = (void *)-1;
}
}

++loop;
}

free_rr_data(&data[0]);
Expand Down