Derecho-Project / derecho

The main code repository for the Derecho project.
BSD 3-Clause "New" or "Revised" License
187 stars 47 forks source link

Partial fix for P2PConnection concurrency issues #229

Closed etremel closed 2 years ago

etremel commented 2 years ago

This is a first step towards solving the thread safety problem identified in #217. P2PConnection now requires callers to specify the message type for get_sendbuffer_ptr, send, and increment_incoming_seq_num, instead of trying to internally keep track of the "last used" type with the instance variables prev_mode and last_type. This fixes the race condition I encountered while testing external-client notifications, though it still doesn't make P2PConnection completely thread-safe.

Since these changes are pretty straightforward, and I tested them to confirm they don't break any existing functionality, I think we should merge them before adding more synchronization to P2PConnection.