fission-codes / go-car-mirror

Generic Go implementation of the CAR Mirror protocol
Apache License 2.0
4 stars 0 forks source link

Multiple fixes for avoiding unnecessary requests, ensuring sessions terminate properly, fixing race conditions #103

Closed justindotpub closed 1 year ago

justindotpub commented 1 year ago

[fix] Add startedCh to SourceSession and SinkSession and use it to ensure session is started before interacting with it. [chore] Rename CLOSING to SINK_CLOSING to reflect its meaning. [fix] Incorrect definition of SOURCE state to include SINK_CLOSING. [fix] In SimpleBatchBlockReceiver.HandleList, check for SOURCE_CLOSING, not SINK_CLOSING, before notifying BEGIN_CLOSE. [fix] Add SOURCE_CLOSED set logic to END_DRAINING as well as the current BEGIN_DRAINING, to ensure that we are closed before the next loop iteration. [fix] Close senders after sessions are closed. [fix] Update RequestBatchBlockSender to only send the request if we have more blocks. [fix] Update RequestStatusSender to only send status if we have wanted blocks. [chore] Add comments for things we'll need to address later. [chore] Remove some unnecessary log statements. [chore] Add .PHONY for each target [chore] Add -race to all tests [fix] Eliminate some race conditions detected [chore] Add lint task [feat] Implement SourceResponder and SinkResponder, to coincide with how "session" Run methods are running until completion of current work, not until completion of spec session. Baby steps.

justindotpub commented 1 year ago

These changes have fixed the hanging pull issue. However, in order to get the go-car-mirror tests to pass it appears I'm going to need to tease apart some of the code in http/connection.go such that it isn't tied to http as transport.

justindotpub commented 1 year ago

Now this branch includes quite a bit of refactoring, and pull is broken again, but I know why and plan on working on it next week.