MCPcopy Create free account
hub / github.com/bloomberg/comdb2 / process_ack_with_payload

Function process_ack_with_payload

net/net_evbuffer.c:1403–1433  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1401}
1402
1403static int process_ack_with_payload(struct event_info *e)
1404{
1405 host_node_type *host_node_ptr = e->host_node_ptr;
1406 net_ack_message_payload_type *ack = &e->ack;
1407 if (e->state == 0) {
1408 ++e->state;
1409 net_ack_message_payload_type_get(ack, e->rd_buf, e->rd_buf + sizeof(*ack));
1410 e->need = ack->paylen;
1411 return 0;
1412 }
1413 void *p = malloc(ack->paylen);
1414 memcpy(p, e->rd_buf, ack->paylen);
1415 Pthread_mutex_lock(&host_node_ptr->wait_mutex);
1416 seq_data *ptr = host_node_ptr->wait_list;
1417 while (ptr != NULL && (ptr->seqnum != ack->seqnum)) {
1418 ptr = ptr->next;
1419 }
1420 if (ptr) {
1421 ptr->ack = 1;
1422 ptr->outrc = ack->outrc;
1423 ptr->payload = p;
1424 ptr->payloadlen = ack->paylen;
1425 Pthread_cond_signal(&host_node_ptr->ack_wakeup);
1426 }
1427 Pthread_mutex_unlock(&host_node_ptr->wait_mutex);
1428 if (!ptr) {
1429 free(p);
1430 }
1431 message_done(e);
1432 return 0;
1433}
1434
1435static int process_decom_nodenum(struct event_info *e)
1436{

Callers 1

process_payloadFunction · 0.85

Calls 4

mallocFunction · 0.85
freeFunction · 0.85
message_doneFunction · 0.85

Tested by

no test coverage detected