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

Function send_message

tests/hello_world.cpp:47–60  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

45}
46
47void send_message(PeerId peer, MessageType type, const char* text, int size)
48{
49 if (size > 255) {
50 return;
51 }
52 uint8_t buff[MAX_MESSAGE_SIZE];
53
54 buff[0] = (uint8_t)type;
55 buff[1] = (uint8_t)size;
56 if (size > 0) {
57 memcpy(buff + 2, text, size);
58 }
59 humblenet_p2p_sendto(buff, size + 2, peer, SEND_RELIABLE, CHANNEL);
60}
61
62void process_message(PeerId remotePeer, const uint8_t* buffer, int buffer_size, int message_size)
63{

Callers 4

process_messageFunction · 0.85
sendChatFunction · 0.85
connectToPeerFunction · 0.85
main_loopFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected