ReplyPromise does not serialize an empty NetworkAddress
This commit is contained in:
parent
5e03e178de
commit
3b5b03e435
|
@ -913,11 +913,8 @@ Future<Void> FlowTransport::bind( NetworkAddress publicAddress, NetworkAddress l
|
|||
return listenF;
|
||||
}
|
||||
|
||||
void FlowTransport::loadedEndpoint( Endpoint& endpoint ) {
|
||||
if (endpoint.getPrimaryAddress().isValid()) return;
|
||||
ASSERT( !(endpoint.token.first() & TOKEN_STREAM_FLAG) ); // Only reply promises are supposed to be unaddressed
|
||||
ASSERT( g_currentDeliveryPeerAddress.address.isValid() );
|
||||
endpoint.addresses = g_currentDeliveryPeerAddress;
|
||||
Endpoint FlowTransport::loadedEndpoint( const UID& token ) {
|
||||
return Endpoint(g_currentDeliveryPeerAddress, token);
|
||||
}
|
||||
|
||||
void FlowTransport::addPeerReference( const Endpoint& endpoint, NetworkMessageReceiver* receiver ) {
|
||||
|
|
|
@ -154,16 +154,10 @@ public:
|
|||
static NetworkAddress getGlobalLocalAddress() { return transport().getLocalAddress(); }
|
||||
static NetworkAddressList getGlobalLocalAddresses() { return transport().getLocalAddresses(); }
|
||||
|
||||
template <class Ar>
|
||||
void loadEndpoint(Ar& ar, Endpoint& e) {
|
||||
ar >> e;
|
||||
loadedEndpoint(e);
|
||||
}
|
||||
Endpoint loadedEndpoint(const UID& token);
|
||||
|
||||
private:
|
||||
class TransportData* self;
|
||||
|
||||
void loadedEndpoint(Endpoint&);
|
||||
};
|
||||
|
||||
inline bool Endpoint::isLocal() const {
|
||||
|
|
|
@ -150,15 +150,15 @@ private:
|
|||
|
||||
template <class Ar, class T>
|
||||
void save(Ar& ar, const ReplyPromise<T>& value) {
|
||||
auto const& ep = value.getEndpoint();
|
||||
auto const& ep = value.getEndpoint().token;
|
||||
ar << ep;
|
||||
ASSERT(!ep.getPrimaryAddress().isValid() || ep.getPrimaryAddress().isPublic()); // No re-serializing non-public addresses (the reply connection won't be available to any other process)
|
||||
}
|
||||
|
||||
template <class Ar, class T>
|
||||
void load(Ar& ar, ReplyPromise<T>& value) {
|
||||
Endpoint endpoint;
|
||||
FlowTransport::transport().loadEndpoint(ar, endpoint);
|
||||
UID token;
|
||||
ar >> token;
|
||||
Endpoint endpoint = FlowTransport::transport().loadedEndpoint(token);
|
||||
value = ReplyPromise<T>(endpoint);
|
||||
networkSender(value.getFuture(), endpoint);
|
||||
}
|
||||
|
@ -364,7 +364,7 @@ void save(Ar& ar, const RequestStream<T>& value) {
|
|||
template <class Ar, class T>
|
||||
void load(Ar& ar, RequestStream<T>& value) {
|
||||
Endpoint endpoint;
|
||||
FlowTransport::transport().loadEndpoint(ar, endpoint);
|
||||
ar >> endpoint;
|
||||
value = RequestStream<T>(endpoint);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue