|
21 | 21 | #include "Framework/CallbackService.h" |
22 | 22 | #include "Framework/ControlService.h" |
23 | 23 | #include "Framework/SourceInfoHeader.h" |
| 24 | +#include "Framework/ChannelInfo.h" |
24 | 25 | #include "Framework/ConfigParamRegistry.h" |
25 | 26 | #include "Framework/RateLimiter.h" |
26 | 27 | #include "Framework/TimingInfo.h" |
@@ -397,17 +398,27 @@ DataProcessorSpec specifyExternalFairMQDeviceProxy(char const* name, |
397 | 398 | // will be multiple channels. At least we throw a more informative exception. |
398 | 399 | // fair::mq::Device calls the custom init before the channels have been configured |
399 | 400 | // so we do the check before starting in a dedicated callback |
400 | | - auto channelConfigurationChecker = [channel, device]() { |
| 401 | + auto channelConfigurationChecker = [channel, device, &services = ctx.services()]() { |
| 402 | + auto& deviceState = services.get<DeviceState>(); |
401 | 403 | if (device->fChannels.count(channel) == 0) { |
402 | 404 | throw std::runtime_error("the required out-of-band channel '" + channel + "' has not been configured, please check the name in the channel configuration"); |
403 | 405 | } |
| 406 | + LOGP(detail, "Injecting channel '{}' into DPL configuration", channel); |
| 407 | + // Converter should pump messages |
| 408 | + deviceState.inputChannelInfos.push_back(InputChannelInfo{ |
| 409 | + .state = InputChannelState::Running, |
| 410 | + .hasPendingEvents = false, |
| 411 | + .readPolled = false, |
| 412 | + .channel = nullptr, |
| 413 | + .id = {ChannelIndex::INVALID}, |
| 414 | + }); |
404 | 415 | }; |
405 | 416 | ctx.services().get<CallbackService>().set(CallbackService::Id::Start, channelConfigurationChecker); |
406 | | - // Converter should pump messages |
407 | 417 |
|
408 | 418 | auto dataHandler = [device, converter, |
409 | 419 | outputRoutes = std::move(outputRoutes), |
410 | 420 | control = &ctx.services().get<ControlService>(), |
| 421 | + deviceState = &ctx.services().get<DeviceState>(), |
411 | 422 | &timingInfo = ctx.services().get<TimingInfo>(), |
412 | 423 | outputChannels = std::move(outputChannels)](fair::mq::Parts& inputs, int) { |
413 | 424 | // pass a copy of the outputRoutes |
@@ -436,6 +447,10 @@ DataProcessorSpec specifyExternalFairMQDeviceProxy(char const* name, |
436 | 447 | converter(timingInfo, *device, inputs, channelRetriever); |
437 | 448 |
|
438 | 449 | if (doEos) { |
| 450 | + // Mark all input channels as closed |
| 451 | + for (auto& info : deviceState->inputChannelInfos) { |
| 452 | + info.state = InputChannelState::Completed; |
| 453 | + } |
439 | 454 | control->endOfStream(); |
440 | 455 | } |
441 | 456 | }; |
|
0 commit comments