-
Notifications
You must be signed in to change notification settings - Fork 15
Server connection can't send money on 'connection' event #70
Comments
What if |
The main issue I see is that we do kind of want the |
I see what you mean (and this may be a separate issue), but I don't really like the asymmetry in the API of: the client doesn't get the use a connection until the rate is available, whereas the server gets it immediately. Is the |
We could set the |
That sounds reasonable. Its also has the benefit of being extremely similar to how data offsets are handled. If a connection/stream is initially configured with |
Ah, good point -- that was another reason we didn't set it higher later. If we follow the QUIC model, it isn't possible to lower the limits. Because you don't know what order packets were sent in, they assume that you only ever raise the limits and can discard anything that's lower. One option might be to: |
Right now the connection allows the data offset to be decreased in some cases -- is that a bug? ( ilp-protocol-stream/src/connection.ts Lines 634 to 635 in afd51ba
I can't find any issues with your proposed solution -- if some race occurs and one side does oversend, they'd just get a ILP reject packet with a StreamMaxMoney frame which seems like the right behavior. |
Yup, exactly. If that solution sounds good I'll try to implement it some time soon. |
That solution sounds good. Re: the data offsets, it is a bit different from money -- if one side sends too much data it's a flow control error and the connection is terminated, as opposed to money which just rejects the packet. |
@emschwartz thinking about this some more, won't this be a breaking change? The current implementation of stream is expecting a MaxMoneyFrame, and if it doesn't get one from the new version of stream it will assume a RemoteReceiveMax of 0, which is blocked. |
Good point. Sounds like we can only do two of these three things:
Need to think about this a bit more, but this is definitely the kind of assumption that should be made explicit in the spec. |
Sending money from the server doesn't work well right now. The
connection
event is emitted beforeconnection.handlePrepare
is called, so the connection hasn't processed the request frames (that include the other party's ILP address) yet. As a result, if you callsetSendMax
synchronously, it will stop because it doesn't know the destination address.I think we could address the sending money issue by making sure to restart the send loop once the
connect
event is emitted. However, it's still strange that theconnection.destinationAccount
isundefined
on the server side, so it feels like we should solve this in a better way.I'm not sure about the best way to do this right now so open to suggestions.
The text was updated successfully, but these errors were encountered: