Ensure initial synchronization is atomic.

This commit is contained in:
Peter Johnson
2015-07-31 23:56:06 -07:00
parent 0a10778697
commit 11508b77d1
5 changed files with 29 additions and 23 deletions

View File

@@ -21,7 +21,7 @@ namespace nt {
class NetworkConnection {
public:
enum State { kCreated, kInit, kHandshake, kActive, kDead };
enum State { kCreated, kInit, kHandshake, kSynchronized, kActive, kDead };
typedef std::function<bool(
NetworkConnection& conn,
@@ -29,8 +29,7 @@ class NetworkConnection {
std::function<void(llvm::ArrayRef<std::shared_ptr<Message>>)> send_msgs)>
HandshakeFunc;
typedef std::function<void(std::shared_ptr<Message> msg,
NetworkConnection* conn, unsigned int proto_rev)>
ProcessIncomingFunc;
NetworkConnection* conn)> ProcessIncomingFunc;
typedef std::vector<std::shared_ptr<Message>> Outgoing;
typedef ConcurrentQueue<Outgoing> OutgoingQueue;