Changeset 4381
- Timestamp:
- 12/03/09 12:02:46 (8 months ago)
- Location:
- branches/2.0/varnish-cache
- Files:
-
- 7 modified
-
bin/varnishd/cache_backend_poll.c (modified) (3 diffs)
-
bin/varnishd/cache_backend_poll.h (modified) (1 diff)
-
bin/varnishtest/tests/v00002.vtc (modified) (1 diff)
-
bin/varnishtest/tests/v00005.vtc (modified) (1 diff)
-
include/vrt.h (modified) (1 diff)
-
lib/libvcl/vcc_backend.c (modified) (4 diffs)
-
lib/libvcl/vcc_fixed_token.c (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/2.0/varnish-cache/bin/varnishd/cache_backend_poll.c
r4303 r4381 173 173 } 174 174 vt->good_xmit |= 1; 175 176 /* And do a shutdown(WR) so we know that the backend got it */177 i = shutdown(s, SHUT_WR);178 if (i != 0) {179 vt->err_shut |= 1;180 TCP_close(&s);181 return;182 }183 vt->good_shut |= 1;184 185 /* Check if that took too long time */186 t_now = TIM_real();187 tmo = (int)round((t_end - t_now) * 1e3);188 if (tmo < 0) {189 TCP_close(&s);190 return;191 }192 175 193 176 pfd->fd = s; … … 237 220 i = sscanf(vt->resp_buf, "HTTP/%*f %u %s", &resp, buf); 238 221 239 if (i == 2 && resp == 200)222 if (i == 2 && resp == vt->probe.exp_status) 240 223 vt->happy |= 1; 241 224 } … … 336 319 if (vt->probe.threshold == 0) 337 320 vt->probe.threshold = 3; 321 if (vt->probe.exp_status == 0) 322 vt->probe.exp_status = 200; 338 323 339 324 if (vt->probe.threshold == ~0U) -
branches/2.0/varnish-cache/bin/varnishd/cache_backend_poll.h
r3557 r4381 34 34 BITMAP( err_xmit, 'x', "Error Xmit", 0) 35 35 BITMAP(good_xmit, 'X', "Good Xmit", 0) 36 BITMAP( err_shut, 's', "Error Shut", 0)37 BITMAP(good_shut, 'S', "Good Shut", 0)38 36 BITMAP( err_recv, 'r', "Error Recv", 0) 39 37 BITMAP(good_recv, 'R', "Good Recv", 0) -
branches/2.0/varnish-cache/bin/varnishtest/tests/v00002.vtc
r3293 r4381 186 186 } 187 187 188 189 varnish v1 -badvcl { 190 backend b1 { 191 .host = "127.0.0.1"; 192 .probe = { .expected_response = 13; } 193 } 194 } 195 -
branches/2.0/varnish-cache/bin/varnishtest/tests/v00005.vtc
r3278 r4381 2 2 3 3 test "VCL: test backend probe syntax" 4 5 # Check status definition 6 varnish v1 -vcl { 7 backend b1 { 8 .host = "127.0.0.1"; 9 .probe = { 10 .expected_response = 204; 11 } 12 } 13 } 4 14 5 15 # Check url definition -
branches/2.0/varnish-cache/include/vrt.h
r4303 r4381 53 53 double timeout; 54 54 double interval; 55 unsigned exp_status; 55 56 unsigned window; 56 57 unsigned threshold; -
branches/2.0/varnish-cache/lib/libvcl/vcc_backend.c
r4303 r4381 342 342 struct token *t_did = NULL, *t_window = NULL, *t_threshold = NULL; 343 343 struct token *t_initial = NULL; 344 unsigned window, threshold, initial ;344 unsigned window, threshold, initial, status; 345 345 346 346 fs = vcc_FldSpec(tl, 347 347 "?url", 348 348 "?request", 349 "?expected_response", 349 350 "?timeout", 350 351 "?interval", … … 360 361 threshold = 0; 361 362 initial = 0; 363 status = 0; 362 364 Fb(tl, 0, "\t.probe = {\n"); 363 365 while (tl->t->tok != '}') { … … 403 405 t_initial = tl->t; 404 406 initial = vcc_UintVal(tl); 407 vcc_NextToken(tl); 408 ERRCHK(tl); 409 } else if (vcc_IdIs(t_field, "expected_response")) { 410 status = vcc_UintVal(tl); 411 if (status < 100 || status > 999) { 412 vsb_printf(tl->sb, 413 "Must specify .status with exactly three " 414 " digits (100 <= x <= 999)\n"); 415 vcc_ErrWhere(tl, tl->t); 416 return; 417 } 405 418 vcc_NextToken(tl); 406 419 ERRCHK(tl); … … 456 469 else 457 470 Fb(tl, 0, "\t\t.initial = ~0U,\n", initial); 471 if (status > 0) 472 Fb(tl, 0, "\t\t.exp_status = %u,\n", status); 458 473 Fb(tl, 0, "\t},\n"); 459 474 ExpectErr(tl, '}'); -
branches/2.0/varnish-cache/lib/libvcl/vcc_fixed_token.c
r4304 r4381 247 247 vsb_cat(sb, "\nstruct vrt_backend_probe {\n\tconst char\t*url;\n"); 248 248 vsb_cat(sb, "\tconst char\t*request;\n\tdouble\t\ttimeout;\n"); 249 vsb_cat(sb, "\tdouble\t\tinterval;\n\tunsigned\twindow;\n"); 250 vsb_cat(sb, "\tunsigned\tthreshold;\n\tunsigned\tinitial;\n"); 251 vsb_cat(sb, "};\n\n/*\n * A backend is a host+port somewhere on the"); 252 vsb_cat(sb, " network\n */\nstruct vrt_backend {\n"); 253 vsb_cat(sb, "\tconst char\t\t\t*vcl_name;\n\tconst char\t\t\t*ident"); 254 vsb_cat(sb, ";\n\n\tconst char\t\t\t*hosthdr;\n"); 255 vsb_cat(sb, "\n\tconst unsigned char\t\t*ipv4_sockaddr;\n"); 249 vsb_cat(sb, "\tdouble\t\tinterval;\n\tunsigned\texp_status;\n"); 250 vsb_cat(sb, "\tunsigned\twindow;\n\tunsigned\tthreshold;\n"); 251 vsb_cat(sb, "\tunsigned\tinitial;\n};\n\n/*\n"); 252 vsb_cat(sb, " * A backend is a host+port somewhere on the network\n"); 253 vsb_cat(sb, " */\nstruct vrt_backend {\n\tconst char\t\t\t*vcl_name"); 254 vsb_cat(sb, ";\n\tconst char\t\t\t*ident;\n\n"); 255 vsb_cat(sb, "\tconst char\t\t\t*hosthdr;\n\n"); 256 vsb_cat(sb, "\tconst unsigned char\t\t*ipv4_sockaddr;\n"); 256 257 vsb_cat(sb, "\tconst unsigned char\t\t*ipv6_sockaddr;\n"); 257 258 vsb_cat(sb, "\n\tdouble\t\t\t\tconnect_timeout;\n"); … … 325 326 /* ../../include/vrt_obj.h */ 326 327 327 vsb_cat(sb, "/*\n * $Id : vcc_gen_obj.tcl 4082 2009-05-19 07:14:00Z");328 vsb_cat(sb, " sky $\n *\n * NB: This file is machine generated, DO");329 vsb_cat(sb, " NOT EDIT!\n *\n * Edit vcc_gen_obj.tcl instead\n");328 vsb_cat(sb, "/*\n * $Id$\n"); 329 vsb_cat(sb, " *\n * NB: This file is machine generated, DO NOT EDI"); 330 vsb_cat(sb, "T!\n *\n * Edit vcc_gen_obj.tcl instead\n"); 330 331 vsb_cat(sb, " */\n\nstruct sockaddr * VRT_r_client_ip(const struct "); 331 332 vsb_cat(sb, "sess *);\nstruct sockaddr * VRT_r_server_ip(struct ses");
