You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Integrate async-init pattern to network/Connection.ts #293
The network/Connection.ts and derived classes are still using the old manual start booleans. These should have async-init applied as well. I recommend using CreateDestroy instead of startstop.
Make sure to update ForwardProxy and ReverseProxy as well as the entire connection object lifecycle is managed by these 2.
Because Connection is an abstract class, the pattern has to follow the same style as GRPCClient. The static creation function instead creates parameters used to construct the derived classes.
The ForwardProxy and ReverseProxy is already StartStop pattern this is because their start relies on parameters that only exist when GRPC related objects have started. But also the GRPC related objects can only start once they have properties that PolykeyAgent has when it's already constructed. This means due to transitivity, both of these do not have asynchronous creation.
The ConnectionForward and ConnectionReverse can be made into CreateDestroy since both uses of them are always started as soon as they are created. However due to the usage of abstract class, then the pattern is applied to the ConnectionForward and ConnectionReverse directly.
After attempting to do this, asynchronous creation is going to be difficult for ConnectionForward and ConnectionReverse as they have conditions like resolveReadyP which is assigned to the instance and used by handlers like handleMessage.
If seems making it CreateDestroy would requires bigger overhaul then it deserves right now. So instead I will just keep it as StartStop as it works this way.
Activity
CMCDragonkai commentedon Nov 25, 2021
It'd be important to revert some of the changes done to networking until a proper review @tegefaulkes
CMCDragonkai commentedon Dec 15, 2021
The
ForwardProxyandReverseProxyis alreadyStartStoppattern this is because their start relies on parameters that only exist when GRPC related objects have started. But also the GRPC related objects can only start once they have properties thatPolykeyAgenthas when it's already constructed. This means due to transitivity, both of these do not have asynchronous creation.The
ConnectionForwardandConnectionReversecan be made intoCreateDestroysince both uses of them are always started as soon as they are created. However due to the usage of abstract class, then the pattern is applied to theConnectionForwardandConnectionReversedirectly.CMCDragonkai commentedon Dec 15, 2021
After attempting to do this, asynchronous creation is going to be difficult for
ConnectionForwardandConnectionReverseas they have conditions likeresolveReadyPwhich is assigned to the instance and used by handlers likehandleMessage.If seems making it
CreateDestroywould requires bigger overhaul then it deserves right now. So instead I will just keep it asStartStopas it works this way.CMCDragonkai commentedon Dec 15, 2021
So it's now
StartStop. Note thatcomposedis a separate state from being running or not.