feat: execute durable client commands through supervisor
This commit is contained in:
@@ -77,16 +77,27 @@ func Reconcile(ctx context.Context, transport Transport, session Session, snapsh
|
||||
if err := transport.Write(ctx, encoded); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
received, err := transport.Read(ctx)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
for {
|
||||
received, err := transport.Read(ctx)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
result, err := agentproto.DecodeEnvelope(received, limits, rvboxv1.Platform_PLATFORM_WINDOWS)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("decode reconciliation response: %w", err)
|
||||
}
|
||||
if result.GetSessionId() != session.ID || result.GetSessionGeneration() != session.Generation {
|
||||
return nil, ErrProtocolHandshake
|
||||
}
|
||||
if result.GetReconcileRequest() != nil {
|
||||
// The request may have been queued before the client's snapshot write
|
||||
// reached the server. The snapshot is already on the wire; consume the
|
||||
// advisory target frame and continue waiting for the durable result.
|
||||
continue
|
||||
}
|
||||
if result.GetReconcileResult() == nil {
|
||||
return nil, ErrProtocolHandshake
|
||||
}
|
||||
return proto.Clone(result.GetReconcileResult()).(*rvboxv1.ReconcileResult), nil
|
||||
}
|
||||
result, err := agentproto.DecodeEnvelope(received, limits, rvboxv1.Platform_PLATFORM_WINDOWS)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("decode ReconcileResult: %w", err)
|
||||
}
|
||||
if result.GetSessionId() != session.ID || result.GetSessionGeneration() != session.Generation || result.GetReconcileResult() == nil {
|
||||
return nil, ErrProtocolHandshake
|
||||
}
|
||||
return proto.Clone(result.GetReconcileResult()).(*rvboxv1.ReconcileResult), nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user