Commit 2f911fa3 authored by Geoff Simmons's avatar Geoff Simmons

trackrdrd: Fixed off-by-one error in parse.c/Parse_ReqStart

           Mutexing increment of tbl.open after ReqStart
vcl: do not log the URL /ts-rcv
parent ed6f014b
...@@ -103,6 +103,7 @@ MON_StatsUpdate(stats_update_t update) ...@@ -103,6 +103,7 @@ MON_StatsUpdate(stats_update_t update)
break; break;
case STATS_OCCUPANCY: case STATS_OCCUPANCY:
tbl.open++;
if (tbl.open + tbl.done > tbl.occ_hi) if (tbl.open + tbl.done > tbl.occ_hi)
tbl.occ_hi = tbl.open + tbl.done; tbl.occ_hi = tbl.open + tbl.done;
break; break;
......
...@@ -56,7 +56,7 @@ int ...@@ -56,7 +56,7 @@ int
Parse_ReqStart(const char *ptr, int len, unsigned *xid) Parse_ReqStart(const char *ptr, int len, unsigned *xid)
{ {
int i; int i;
for (i = len; ptr[i] != ' '; i--) for (i = len-1; ptr[i] != ' '; i--)
if (i == 0) if (i == 0)
return EINVAL; return EINVAL;
return Parse_XID(&ptr[i+1], len-i-1, xid); return Parse_XID(&ptr[i+1], len-i-1, xid);
......
...@@ -122,6 +122,20 @@ static char ...@@ -122,6 +122,20 @@ static char
sprintf(errmsg, "ReqStart %s: returned XID=%d", REQSTART, xid); sprintf(errmsg, "ReqStart %s: returned XID=%d", REQSTART, xid);
mu_assert(errmsg, xid == 1253687608); mu_assert(errmsg, xid == 1253687608);
#define REQSTART2 "127.0.0.1 56431 18217014 "
err = Parse_ReqStart(REQSTART2, strlen(REQSTART2)-1, &xid);
sprintf(errmsg, "ReqStart %s: %s", REQSTART2, strerror(err));
mu_assert(errmsg, err == 0);
sprintf(errmsg, "ReqStart %s: returned XID=%d", REQSTART2, xid);
mu_assert(errmsg, xid == 18217014);
#define REQSTART3 "127.0.0.1 53890 18228551 "
err = Parse_ReqStart(REQSTART3, strlen(REQSTART3)-1, &xid);
sprintf(errmsg, "ReqStart %s: %s", REQSTART3, strerror(err));
mu_assert(errmsg, err == 0);
sprintf(errmsg, "ReqStart %s: returned XID=%d", REQSTART3, xid);
mu_assert(errmsg, xid == 18228551);
err = Parse_ReqStart("1253687608", 10, &xid); err = Parse_ReqStart("1253687608", 10, &xid);
sprintf(errmsg, "ReqStart 1253687608: expected EINVAL, got %d", err); sprintf(errmsg, "ReqStart 1253687608: expected EINVAL, got %d", err);
mu_assert(errmsg, err == EINVAL); mu_assert(errmsg, err == EINVAL);
......
...@@ -126,7 +126,7 @@ static inline dataentry ...@@ -126,7 +126,7 @@ static inline dataentry
entry->end = strlen(entry->data); entry->end = strlen(entry->data);
if (entry->end > tbl.data_hi) if (entry->end > tbl.data_hi)
tbl.data_hi = entry->end; tbl.data_hi = entry->end;
tbl.open++; tbl.seen++;
MON_StatsUpdate(STATS_OCCUPANCY); MON_StatsUpdate(STATS_OCCUPANCY);
return entry; return entry;
...@@ -180,12 +180,11 @@ OSL_Track(void *priv, enum VSL_tag_e tag, unsigned fd, unsigned len, ...@@ -180,12 +180,11 @@ OSL_Track(void *priv, enum VSL_tag_e tag, unsigned fd, unsigned len,
case SLT_ReqStart: case SLT_ReqStart:
if (term) return(0); if (term) return(0);
err = Parse_ReqStart(ptr, len, &xid); err = Parse_ReqStart(ptr, len, &xid);
AZ(err); AZ(err);
LOG_Log(LOG_DEBUG, "%s: XID=%d", VSL_tags[tag], xid); LOG_Log(LOG_DEBUG, "%s: XID=%d", VSL_tags[tag], xid);
tbl.seen++;
(void) insert(xid, tag, fd); (void) insert(xid, tag, fd);
break; break;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment