Handling multiple 'concurrent' messages in a distributed system

Hi guys, I'm trying to write a distributed message broker in Rust. So far I'm really really enjoying the language and everything behind it.

I'm running into a problem with my distributed consensus protocol and this is probably the most trivial thing.

I can't figure out how to do handle concurrent resource locks or concurrent messages at all. I'll try to implement Lamport's algorithm for distributed mutual exclusion, however I'm looking for more opinions on this problem and preferably a more architectural anecdote. I think this can be easily done with some intelligent usage of data structures and mutexes but I can't figure out a solution on my own.

I don't think I have information enough to help you here.