Add INetworkConnection interface for unit testing.

This commit is contained in:
Peter Johnson
2017-09-04 22:01:59 -07:00
parent 7c1d2f4bc4
commit cedbafeb28
12 changed files with 143 additions and 59 deletions

View File

@@ -21,7 +21,7 @@
namespace nt {
class IDispatcher;
class NetworkConnection;
class INetworkConnection;
class IStorage {
public:
@@ -42,12 +42,13 @@ class IStorage {
virtual NT_Type GetMessageEntryType(unsigned int id) const = 0;
virtual void ProcessIncoming(std::shared_ptr<Message> msg,
NetworkConnection* conn,
std::weak_ptr<NetworkConnection> conn_weak) = 0;
INetworkConnection* conn,
std::weak_ptr<INetworkConnection> conn_weak) = 0;
virtual void GetInitialAssignments(
NetworkConnection& conn, std::vector<std::shared_ptr<Message>>* msgs) = 0;
INetworkConnection& conn,
std::vector<std::shared_ptr<Message>>* msgs) = 0;
virtual void ApplyInitialAssignments(
NetworkConnection& conn, llvm::ArrayRef<std::shared_ptr<Message>> msgs,
INetworkConnection& conn, llvm::ArrayRef<std::shared_ptr<Message>> msgs,
bool new_server, std::vector<std::shared_ptr<Message>>* out_msgs) = 0;
// Filename-based save/load functions. Used both by periodic saves and