MCPcopy Create free account
hub / github.com/data61/MP-SPDZ / NewMsg

Method NewMsg

BMR/network/Node.cpp:95–126  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

93}
94
95void Node::NewMsg(ReceivedMsg& message, struct sockaddr_in* from) {
96 char* msg = message.data();
97 size_t len = message.size();
98#ifdef DEBUG_COMM
99 printf("Node:: got message of length %u at 0x%x\n",len,msg);
100 printf("from %s:%d\n", inet_ntoa(from->sin_addr), ntohs(from->sin_port));
101 phex(msg, 4);
102#endif
103 if(len == strlen(ID_HDR)+sizeof(_id) && 0==strncmp(msg, ID_HDR, strlen(ID_HDR))) {
104 int *id = (int*)(msg+strlen(ID_HDR));
105 printf("Node:: identified as party: %d\n", *id);
106 assert(*id >=0 && *id <= _numparties && *id !=_id && !_clients_connected[*id]);
107 _clients_connected[*id] = true;
108 _clientsmap.insert(std::pair<struct sockaddr_in*,int>( from, *id));
109 _ready_nodes[*id] = true;
110 printf("Node:: _ready_nodes[%d]=%d\n",*id,_ready_nodes[*id]);
111 return;
112 } else if (len == strlen(ALL_IDENTIFIED) && 0==strncmp(msg, ALL_IDENTIFIED, strlen(ALL_IDENTIFIED))) {
113 printf("Node:: received ALL_IDENTIFIED from %d\n",_clientsmap[from]);
114 _num_parties_identified++;
115 if(_num_parties_identified == _numparties-1) {
116 printf("Node:: received ALL_IDENTIFIED from ALL\n");
117 _updatable->NodeReady();
118 }
119 return;
120 }
121 _updatable->NewMessage(_clientsmap[from], message);
122#ifdef DEBUG_COMM
123 printf("finished with %d bytes at 0x%x\n", len, msg);
124 phex(msg, 4);
125#endif
126}
127
128void Node::ClientsConnected() {
129 printf("Node:: Clients connected!\n");

Callers 1

_listen_to_clientMethod · 0.80

Calls 6

phexFunction · 0.70
dataMethod · 0.45
sizeMethod · 0.45
insertMethod · 0.45
NodeReadyMethod · 0.45
NewMessageMethod · 0.45

Tested by

no test coverage detected