use EnsureTable for enums of enums

This commit is contained in:
mpilman 2019-01-31 15:07:27 -08:00
parent 7affe73774
commit 47fdb78782
3 changed files with 8 additions and 8 deletions

View File

@ -265,8 +265,8 @@ TEST_CASE("/flow/FlatBuffers/LeaderInfo") {
}
leaderInfo.serializedInfo = rndString;
}
ErrorOr<Optional<LeaderInfo>> objIn{ Optional<LeaderInfo>{leaderInfo} };
ErrorOr<Optional<LeaderInfo>> objOut;
ErrorOr<EnsureTable<Optional<LeaderInfo>>> objIn(leaderInfo);
ErrorOr<EnsureTable<Optional<LeaderInfo>>> objOut;
Standalone<StringRef> copy;
ObjectWriter writer;
writer.serialize(objIn);
@ -275,8 +275,8 @@ TEST_CASE("/flow/FlatBuffers/LeaderInfo") {
reader.deserialize(objOut);
ASSERT(!objOut.isError());
ASSERT(objOut.get().present());
LeaderInfo outLeader = objOut.get().get();
ASSERT(objOut.get().asUnderlyingType().present());
LeaderInfo outLeader = objOut.get().asUnderlyingType().get();
ASSERT(outLeader.changeID == leaderInfo.changeID);
ASSERT(outLeader.forward == leaderInfo.forward);
ASSERT(outLeader.serializedInfo == leaderInfo.serializedInfo);

View File

@ -96,12 +96,12 @@ struct NetSAV : SAV<T>, FlowReceiver, FastAllocated<NetSAV<T>> {
virtual void receive(ArenaObjectReader& reader) {
if (!SAV<T>::canBeSet()) return;
this->addPromiseRef();
ErrorOr<T> message;
ErrorOr<EnsureTable<T>> message;
reader.deserialize(message);
if (message.isError()) {
SAV<T>::sendErrorAndDelPromiseRef(message.getError());
} else {
SAV<T>::sendAndDelPromiseRef(message.get());
SAV<T>::sendAndDelPromiseRef(message.get().asUnderlyingType());
}
}
};

View File

@ -35,7 +35,7 @@ void networkSender(Future<T> input, Endpoint endpoint) {
try {
T value = wait(input);
if (g_network->useObjectSerializer()) {
FlowTransport::transport().sendUnreliable(SerializeSource<ErrorOr<T>>(ErrorOr<T>(value)), endpoint);
FlowTransport::transport().sendUnreliable(SerializeSource<ErrorOr<EnsureTable<T>>>(value), endpoint);
} else {
FlowTransport::transport().sendUnreliable(SerializeBoolAnd<T>(true, value), endpoint, false);
}
@ -43,7 +43,7 @@ void networkSender(Future<T> input, Endpoint endpoint) {
// if (err.code() == error_code_broken_promise) return;
ASSERT(err.code() != error_code_actor_cancelled);
if (g_network->useObjectSerializer()) {
FlowTransport::transport().sendUnreliable(SerializeSource<ErrorOr<T>>(ErrorOr<T>(err)), endpoint);
FlowTransport::transport().sendUnreliable(SerializeSource<ErrorOr<EnsureTable<T>>>(err), endpoint);
} else {
FlowTransport::transport().sendUnreliable(SerializeBoolAnd<Error>(false, err), endpoint, false);
}