Closed geoffxy closed 6 years ago
Everything got marked as outdated by GitHub... 😞
So I thought about this a bit more: adding a specific InteragentMessageProxy
would work, but I guess it won't generalize as well as what you're trying to achieve with the changes in UDPGateway
.
I think we should still add a middle layer, but maybe just name it something that has to do with fragmentation (e.g. maybe FragmentingMessageProxy
). It can hold a gateway internally and perform the defrag before passing it on to the handler. It can also contain a method to do the fragmentation before writing to the gateway. That way this can be reused on the server if needed. Then UDPGateway
stays low level and is just responsible for binary read/write.
The important thing though is that the defrag code should run on the main thread. So the UDPGateway
's handler_function()
should be some function in TandemAgent
that submits the data to the executor. I think it will be easier to reason about/modify the code later on if all state manipulation happens on one thread.
@geoffxy Sounds good, I'll move the fragmentation code to a separate generalized middle layer
Thanks @jamiboy16! I'll close this PR so you can open a new one and merge 😃
Along with these changes I also switched the interagent serialization format to binary, in an effort to try and reduce the size of messages. The new operations messages are still quite large, unfortunately, because we just serialize it to JSON directly. A 1 character change is usually a ~300 byte message.
I added logic to split and reassemble large new operations messages. I tested by pasting large amounts of text into the editor and it seemed to work fine.