Re: [PATCH v2 09/11] upload-pack, serve: log received client trace2 SID
From: Josh Steadmon <hidden>
Date: 2020-11-05 19:12:44
On 2020.11.04 13:26, Junio C Hamano wrote:
Josh Steadmon [off-list ref] writes:quoted
diff --git a/upload-pack.c b/upload-pack.c index 3bb01c5427..d938603c97 100644 --- a/upload-pack.c +++ b/upload-pack.c@@ -1058,6 +1058,7 @@ static void receive_needs(struct upload_pack_data *data, const char *features; struct object_id oid_buf; const char *arg; + int feature_len; reset_timeout(data->timeout); if (packet_reader_read(reader) != PACKET_READ_NORMAL)@@ -1109,6 +1110,12 @@ static void receive_needs(struct upload_pack_data *data, if (data->allow_filter && parse_feature_request(features, "filter")) data->filter_capability_requested = 1; + if ((arg = parse_feature_value(features, "trace2-sid", &feature_len, NULL))) + {Style. '{' block is opened on the same line as "if (condition)" ends, e.g. arg = parse_feature_value(...); if (arg) { Avoid assignment in the condition part of if/while unless there is a compelling reason to do so. e.g. if ((arg = ...) && further_check_on(arg)) { ... might be justifiable, but here, I do not see any such reason.
Will fix in V3.
quoted
+ char *client_sid = xstrndup(arg, feature_len); + trace2_data_string("trace2", NULL, "client-sid", client_sid); + free(client_sid); + } o = parse_object(the_repository, &oid_buf); if (!o) {Thanks.