Skip to content

Conversation

oncilla
Copy link
Contributor

@oncilla oncilla commented Dec 9, 2019

Add TRC request handler to the trust store.

fixes #3484


This change is Reviewable

@oncilla oncilla force-pushed the pub-trust-handler-trc-req branch from 63c0bc3 to 9bbc143 Compare December 9, 2019 16:51
@oncilla oncilla self-assigned this Dec 10, 2019
@oncilla oncilla force-pushed the pub-trust-handler-trc-req branch from 9bbc143 to d46df0a Compare December 10, 2019 12:40
@lukedirtwalker lukedirtwalker self-requested a review December 10, 2019 13:14
Copy link
Collaborator

@lukedirtwalker lukedirtwalker left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 4 of 4 files at r1.
Reviewable status: all files reviewed, 6 unresolved discussions (waiting on @oncilla)


go/lib/infra/modules/trust/v2/handlers.go, line 28 at r1 (raw file):

// HandlerTimeout is the lifetime of the handlers.
const HandlerTimeout = 3 * time.Second

Do we specifically care about the 3 seconds? isn't the default provided by the messenger "good enough" ?


go/lib/infra/modules/trust/v2/handlers.go, line 32 at r1 (raw file):

// trcReqHandler contains the state of a handler for a specific TRC Request
// message, received via the Messenger's ListenAndServe method.
type trcReqHandler struct {

I that is not public how can it be registered in the messenger in a main then?


go/lib/infra/modules/trust/v2/handlers.go, line 53 at r1 (raw file):

no Messenger found"

no ResponseWriter found


go/lib/infra/modules/trust/v2/handlers.go, line 53 at r1 (raw file):

logger.Warn

Make this an Error log


go/lib/infra/modules/trust/v2/handlers.go, line 56 at r1 (raw file):

		return infra.MetricsErrInternal
	}
	subCtx, cancelF := context.WithTimeout(h.request.Context(), HandlerTimeout)

I think it's good enough to just use the provided context.
At the top I would put:

ctx := request.Context()
logger := log.FromCtx(ctx)

go/lib/infra/modules/trust/v2/handlers.go, line 67 at r1 (raw file):

		opts, h.request.Peer)
	if err != nil {
		logger.Error("[TrustStore:trcReqHandler] Unable to retrieve TRC", "err", err)

Shouldn't we reply with Nack in this case?

@oncilla oncilla force-pushed the pub-trust-handler-trc-req branch from d46df0a to 04a3149 Compare December 10, 2019 14:13
Copy link
Contributor Author

@oncilla oncilla left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: 1 of 4 files reviewed, 6 unresolved discussions (waiting on @lukedirtwalker)


go/lib/infra/modules/trust/v2/handlers.go, line 28 at r1 (raw file):

Previously, lukedirtwalker (Lukas Vogel) wrote…

Do we specifically care about the 3 seconds? isn't the default provided by the messenger "good enough" ?

copy-pasta from the old TS
Done.


go/lib/infra/modules/trust/v2/handlers.go, line 32 at r1 (raw file):

Previously, lukedirtwalker (Lukas Vogel) wrote…

I that is not public how can it be registered in the messenger in a main then?

The trust store struct will have some factory methods that create the handlers.

As you will notice, this is not of type infra.Handler


go/lib/infra/modules/trust/v2/handlers.go, line 53 at r1 (raw file):

Previously, lukedirtwalker (Lukas Vogel) wrote…
no Messenger found"

no ResponseWriter found

Done.


go/lib/infra/modules/trust/v2/handlers.go, line 53 at r1 (raw file):

Previously, lukedirtwalker (Lukas Vogel) wrote…
logger.Warn

Make this an Error log

Done.


go/lib/infra/modules/trust/v2/handlers.go, line 56 at r1 (raw file):

Previously, lukedirtwalker (Lukas Vogel) wrote…

I think it's good enough to just use the provided context.
At the top I would put:

ctx := request.Context()
logger := log.FromCtx(ctx)

Done.


go/lib/infra/modules/trust/v2/handlers.go, line 67 at r1 (raw file):

Previously, lukedirtwalker (Lukas Vogel) wrote…

Shouldn't we reply with Nack in this case?

Done.

Copy link
Collaborator

@lukedirtwalker lukedirtwalker left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:lgtm:

Reviewed 3 of 3 files at r2.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved

@oncilla oncilla force-pushed the pub-trust-handler-trc-req branch from 73ac675 to 978ae31 Compare December 10, 2019 14:40
Add TRC request handler to the trust store.
Currently, the PR is missing unit tests.

fixes scionproto#3484
@oncilla oncilla force-pushed the pub-trust-handler-trc-req branch from 978ae31 to 878d221 Compare December 10, 2019 15:43
Copy link
Collaborator

@lukedirtwalker lukedirtwalker left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 3 of 3 files at r3.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved

@oncilla oncilla merged commit 6da631a into scionproto:master Dec 10, 2019
@oncilla oncilla deleted the pub-trust-handler-trc-req branch December 10, 2019 16:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

TrustStore: TRC req handler
2 participants