Commit 6cce5d92 authored by Titouan Soulard's avatar Titouan Soulard

libcapulet: handle recvfrom errors

parent b34accde
......@@ -14,10 +14,6 @@
#include "common/hashtable.h"
#define CAP_QP_INFO_PTYPE 0x01
#define CAP_MR_QUERY_PTYPE 0x10
#define CAP_MR_INFO_PTYPE 0x11
struct CapuletRdmaMrMgr;
struct CapuletNetUdpQpInfoPacket {
......
......@@ -80,17 +80,22 @@ bool capulet_net_udp_serve_mr(struct CommonHashtableTable *hashtable, int server
struct CommonHashtableElement *el;
struct ibv_mr *mr;
ssize_t recv_size;
size_t buffer_size;
uint8_t receive_buffer[256];
while(1) {
// No need to go too fast, and CPU time is better used anywhere else
usleep(10);
buffer_size = sizeof(struct CapuletNetUdpMrQueryPacket);
recvfrom(server_socket, receive_buffer, buffer_size, 0, &client_addr, &client_addr_size);
recv_size = recvfrom(server_socket, receive_buffer, buffer_size, 0, &client_addr, &client_addr_size);
memcpy((void *) &mr_query_pkt, (void *) receive_buffer, buffer_size);
buffer_size = sizeof(struct CapuletNetUdpMrInfoPacket);
memset(&mr_info_pkt, 0, buffer_size);
if(recv_size == -1) return false;
el = common_hashtable_find(hashtable, mr_query_pkt.name);
if(el) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment