From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-Status: No, score=-11.4 required=3.0 tests=AWL,BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_PASS,SPF_PASS,USER_IN_DEF_DKIM_WL shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by dcvr.yhbt.net (Postfix) with ESMTP id 3447D1F670 for ; Thu, 29 Oct 2020 21:33:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726825AbgJ2Vcy (ORCPT ); Thu, 29 Oct 2020 17:32:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46718 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726809AbgJ2Vcw (ORCPT ); Thu, 29 Oct 2020 17:32:52 -0400 Received: from mail-qv1-xf49.google.com (mail-qv1-xf49.google.com [IPv6:2607:f8b0:4864:20::f49]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 23F64C0613CF for ; Thu, 29 Oct 2020 14:32:52 -0700 (PDT) Received: by mail-qv1-xf49.google.com with SMTP id l1so2601293qvr.5 for ; Thu, 29 Oct 2020 14:32:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=sender:date:in-reply-to:message-id:mime-version:references:subject :from:to; bh=slkhbjCg3Mgmo4W6YmHzUeRTBQJw9wSMrA+Jj2oqGiY=; b=L11w2wNEYCYAkp7dO4YLIZ8dZ6MOzw9yke4WZo+gcXKM3C4bA6ueG2TeqHyYgM1mo+ CV28R/FDerB0cv5stQzDQBhG2Ztqa4YIN9VXbiQjUr9ZqJpVONSIh58cJ9Ubjs0RJct8 zc0Oh/t/dg3ICz1EGboVh0CSLnZzqPWUmKWivZPiTQ5CNubfoDVkMWzJ6aD+VQiG2KNt r+axOiaF4eaDaWxhl6JHuLWhn21uBpB1Yl3LSECHaBgOnnLagheNWgi43WBDYyfT7wVA 3mU1OjUL3Z6Djca3465rTd5Rv35gi4CXMkrWStdreLZzLgb+g44aAPulhpqsG/0EfWNK TK2w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:in-reply-to:message-id:mime-version :references:subject:from:to; bh=slkhbjCg3Mgmo4W6YmHzUeRTBQJw9wSMrA+Jj2oqGiY=; b=uGE69ynOZYBGsrF2GCmVzJOnV8+2MACjN/+wVHl3FwoN8uOS/DWRiQY7DvMbnBzliN wrgcsHkFINvHSDySA6y7G4H5gQQ8lLcNTBag3Bxy+lpLJiHxl0/tNAlrcVMQZ2hzHYgl nvbX03IhW+A25uTzXKLohmsmAnUe1Jo24DYu+qQsn3vBKsf10wZORLGBCv4vlUkDy2HC nYIkRUnfi9DOcmYDWSXXtvxEscLBX32AyefBLqwUY5z1EE53gjQwi5aprI7nv6ybmDUi EYezZwrtGfnootabikNZFWsgOEfU75OT7QiCoULlAbe3Bomq90G28FDv4hTHvNRlvz9z q33w== X-Gm-Message-State: AOAM531pExmwFI1vFhcGpX85SIRiLTsYbNf4gBwFShNcrxaFE0VkIQye egmGePJV/nD89cDxlsGLCPVqxYgoYrnv7Mb5ClTcFU5TVCQ5WuZlcaTMREWcdBNvrDU5LbHbeYV zKZgXF0YPZWlIvy+avDpXrQcTG+6UYItiPe3HZ6euBh0rwe41YII9VsfktVyYuLA= X-Google-Smtp-Source: ABdhPJw99/IzssIFhzlhMEcJ0tBupwsjJ4NJrZjLGE8JjILoZZlwuzcPm09Yk6fpRYDmgzN65ETGhzfdnnnm/Q== Sender: "steadmon via sendgmr" X-Received: from lunarfall.svl.corp.google.com ([2620:15c:2ce:200:1ea0:b8ff:fe74:b4c1]) (user=steadmon job=sendgmr) by 2002:a0c:ba85:: with SMTP id x5mr6465364qvf.7.1604007171263; Thu, 29 Oct 2020 14:32:51 -0700 (PDT) Date: Thu, 29 Oct 2020 14:32:35 -0700 In-Reply-To: Message-Id: Mime-Version: 1.0 References: X-Mailer: git-send-email 2.29.1.341.ge80a0c044ae-goog Subject: [PATCH 05/10] serve: advertise trace2 SID in v2 capabilities From: Josh Steadmon To: git@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org When trace2 is enabled and trace2.advertiseSID is true, advertise the server's trace2 session ID for all protocol v2 connections via the new trace2-sid capability. Signed-off-by: Josh Steadmon --- serve.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/serve.c b/serve.c index f6341206c4..6ad73d69ab 100644 --- a/serve.c +++ b/serve.c @@ -7,6 +7,9 @@ #include "ls-refs.h" #include "serve.h" #include "upload-pack.h" +#include "trace2/tr2_sid.h" + +static int advertise_trace2_sid; static int always_advertise(struct repository *r, struct strbuf *value) @@ -30,6 +33,15 @@ static int object_format_advertise(struct repository *r, return 1; } +static int trace2_advertise(struct repository *r, struct strbuf *value) +{ + if (!advertise_trace2_sid || !trace2_is_enabled()) + return 0; + if (value) + strbuf_addstr(value, tr2_sid_get()); + return 1; +} + struct protocol_capability { /* * The name of the capability. The server uses this name when @@ -66,6 +78,7 @@ static struct protocol_capability capabilities[] = { { "fetch", upload_pack_advertise, upload_pack_v2 }, { "server-option", always_advertise, NULL }, { "object-format", object_format_advertise, NULL }, + { "trace2-sid", trace2_advertise, NULL }, }; static void advertise_capabilities(void) @@ -261,6 +274,8 @@ static int process_request(void) /* Main serve loop for protocol version 2 */ void serve(struct serve_options *options) { + git_config_get_bool("trace2.advertisesid", &advertise_trace2_sid); + if (options->advertise_capabilities || !options->stateless_rpc) { /* serve by default supports v2 */ packet_write_fmt(1, "version 2\n"); -- 2.29.1.341.ge80a0c044ae-goog