Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions include/proxy/logging/LogAccess.h
Original file line number Diff line number Diff line change
Expand Up @@ -316,6 +316,7 @@ class LogAccess
static int unmarshal_itox(int64_t val, char *dest, int field_width = 0, char leading_char = ' ');
static int unmarshal_int_to_str(char **buf, char *dest, int len);
static int unmarshal_int_to_str_hex(char **buf, char *dest, int len);
static int unmarshal_milestone_diff(char **buf, char *dest, int len);
static int unmarshal_str(char **buf, char *dest, int len, LogSlice *slice, LogEscapeType escape_type);
static int unmarshal_ttmsf(char **buf, char *dest, int len);
static int unmarshal_int_to_date_str(char **buf, char *dest, int len);
Expand Down
37 changes: 37 additions & 0 deletions src/proxy/logging/LogAccess.cc
Original file line number Diff line number Diff line change
Expand Up @@ -626,6 +626,43 @@ LogAccess::unmarshal_int_to_str(char **buf, char *dest, int len)
return -1;
}

/*-------------------------------------------------------------------------
LogAccess::unmarshal_milestone_diff

Unmarshal a milestone difference value. Returns "-" when the
marshalled value is -1 (the "missing" sentinel from difference_msec,
meaning one or both milestones were unset). Other negative values
(reversed milestone order) are preserved as numeric output for
debugging.
-------------------------------------------------------------------------*/

int
LogAccess::unmarshal_milestone_diff(char **buf, char *dest, int len)
{
ink_assert(buf != nullptr);
ink_assert(*buf != nullptr);
ink_assert(dest != nullptr);

int64_t val = unmarshal_int(buf);
if (val == -1) {
if (len >= 1) {
dest[0] = '-';
return 1;
}
DBG_UNMARSHAL_DEST_OVERRUN
return -1;
}

char val_buf[128];
int val_len = unmarshal_itoa(val, val_buf + 127);
if (val_len < len) {
memcpy(dest, val_buf + 128 - val_len, val_len);
return val_len;
}
DBG_UNMARSHAL_DEST_OVERRUN
return -1;
}

/*-------------------------------------------------------------------------
LogAccess::unmarshal_int_to_str_hex

Expand Down
2 changes: 1 addition & 1 deletion src/proxy/logging/LogField.cc
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,7 @@ LogField::LogField(const char *field, Container container)
if (0 != rv) {
Note("Invalid milestone range in LogField ctor: %s", m_name);
}
m_unmarshal_func = &(LogAccess::unmarshal_int_to_str);
m_unmarshal_func = &(LogAccess::unmarshal_milestone_diff);
m_type = LogField::sINT;
break;
}
Expand Down