sidecar: only simulate retransmission for provider if restarting from scratch
We only need to re-send the simulated retransmission message if we're
starting from scratch and haven't yet received the provider's message.
Otherwise, this will cause an unnecessary internal state transition.
@@ -426,8 +426,11 @@ func (a *SidecarNegotiator) autoSidecarProvider(ctx context.Context, startingPkt
localTicket := startingPkt.ProviderTicket
// We'll start with a simulated starting message from the sidecar
- // receiver.
+ // receiver, but only if we're starting in the created state which
+ // demands an internal retransmission.
+ if startingPkt.CurrentState == sidecar.StateCreated {
packetChan <- startingPkt.ReceiverTicket
+ }
// First, we'll need to derive the stream ID that we'll use to receive
// new messages from the recipient.
