--- client_side.c.orig 2004-02-18 20:51:16.000000000 +0200 +++ client_side.c 2004-02-20 21:24:52.000000000 +0200 @@ -1971,6 +1971,37 @@ return; } if (http->out.offset == 0) { + /* Zero Penalty Patch (ZPH) begins here ----> */ + int hit = 0; + switch ( http->log_type ) + { + case LOG_TCP_HIT: + case LOG_TCP_REFRESH_HIT: + case LOG_TCP_REFRESH_FAIL_HIT: + case LOG_TCP_IMS_HIT: + case LOG_TCP_MEM_HIT: + case LOG_TCP_OFFLINE_HIT: + hit = 1; + debug(33, 5) ("ZPH: local hit\n"); + break; + default: + /* Remove next 4 lines for excluding neighbor hits */ + if ( http->request->hier.code == PARENT_HIT || http->request->hier.code == SIBLING_HIT ) { + hit = 1; + debug(33, 5) ("ZPH: neighbor hit\n"); + } + break; + } + if ( hit ) { + int tos = 16; /* iptables hint: TOS = 0x10, DSCP = 0x04 */ + enter_suid(); + if (setsockopt(fd, IPPROTO_IP, IP_TOS, &tos, sizeof(tos)) < 0) { + debug(50, 1) ("ZPH: setsockopt(IP_TOS) on FD %d: %s\n", fd, xstrerror()); + } + leave_suid(); + } + /* <----- End of ZPH */ + rep = clientBuildReply(http, buf, size); if (rep) { aclCheck_t *ch;