Commit 5016e37a authored by Peter-Jan Brone's avatar Peter-Jan Brone

Merge branch 'read-cancellation-token' into pt-duration

parents 1b25043f d2c3f938
......@@ -444,7 +444,7 @@ func (p *renterHostPair) managedExecuteProgram(epr modules.RPCExecuteProgramRequ
}
// Read the cancellation token.
ct := make([]byte, modules.MDMCancellationTokenLen)
var ct modules.MDMCancellationToken
err = modules.RPCRead(stream, &ct)
if err != nil {
return nil, limit, err
......
......@@ -109,7 +109,7 @@ func (h *Host) managedRPCExecuteProgram(stream siamux.Stream) error {
}
// Return 16 bytes of data as a placeholder for a future cancellation token.
ct := make([]byte, modules.MDMCancellationTokenLen)
var ct modules.MDMCancellationToken
err = modules.RPCWrite(stream, ct)
if err != nil {
return errors.AddContext(err, "Failed to write cancellation token")
......
......@@ -25,6 +25,10 @@ type (
Program []Instruction
// ProgramData contains the raw byte data for the program.
ProgramData []byte
// MDMCancellationTokenLen is a token that can be used to request
// cancellation of a program
MDMCancellationToken [MDMCancellationTokenLen]byte
)
const (
......
......@@ -85,7 +85,7 @@ func (w *worker) managedExecuteProgram(p modules.Program, data []byte, fcid type
}
// read the cancellation token.
ct := make([]byte, modules.MDMCancellationTokenLen)
var ct modules.MDMCancellationToken
err = modules.RPCRead(stream, &ct)
if err != nil {
return
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment