MCPcopy Create free account
hub / github.com/HumbleNet/HumbleNet / sendChat

Function sendChat

tests/test_peer.cpp:86–105  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

84}
85
86void sendChat(const char* message)
87{
88 flatbuffers::FlatBufferBuilder builder;
89 auto chatmsg = builder.CreateString(message);
90 auto hello = TestClient::CreateChat(builder, chatmsg);
91 auto msg = TestClient::CreateMessage(builder, TestClient::MessageSwitch_Chat, hello.Union());
92 builder.Finish(msg);
93
94 std::unordered_set<PeerId> toRemove;
95
96 for (auto peer : connectedPeers) {
97 int ret = sendMessage(peer, builder);
98 if (ret < 0) {
99 toRemove.insert(peer);
100 }
101 }
102 for (auto p : toRemove) {
103 disconnectPeer(p);
104 }
105}
106
107void sendChat(const std::string& message)
108{

Callers 3

readInputFunction · 0.70
mainFunction · 0.70
readInputMethod · 0.50

Calls 7

sendMessageFunction · 0.85
disconnectPeerFunction · 0.85
CreateStringMethod · 0.80
UnionMethod · 0.80
FinishMethod · 0.80
c_strMethod · 0.80
insertMethod · 0.45

Tested by

no test coverage detected