From: Michael Fatemi Date: Thu, 27 Jan 2022 03:26:28 +0000 (-0500) Subject: add interface_socket_close and use MSG_WAITALL X-Git-Url: http://kyz.pub/gitweb/?a=commitdiff_plain;h=0d602267555963452a424629ffbbadca9dbaaa6e;p=yn%2Fyn-odas.git add interface_socket_close and use MSG_WAITALL --- diff --git a/include/odas/source/src_hops.h b/include/odas/source/src_hops.h index 0f50a83..d0d59e7 100644 --- a/include/odas/source/src_hops.h +++ b/include/odas/source/src_hops.h @@ -93,6 +93,8 @@ void src_hops_close_interface_file(src_hops_obj *obj); void src_hops_close_interface_soundcard(src_hops_obj *obj); +void src_hops_close_interface_socket(src_hops_obj *obj); + int src_hops_process(src_hops_obj *obj); int src_hops_process_interface_file(src_hops_obj *obj); diff --git a/src/source/src_hops.c b/src/source/src_hops.c index 30b85e3..75577ae 100644 --- a/src/source/src_hops.c +++ b/src/source/src_hops.c @@ -282,6 +282,12 @@ void src_hops_close(src_hops_obj *obj) break; + case interface_socket: + + src_hops_close_interface_socket(obj); + + break; + default: printf("Source hops: Invalid interface type.\n"); @@ -432,11 +438,11 @@ int src_hops_process_interface_socket(src_hops_obj *obj) int rtnValue; // ssize_t recv(int sockfd, void *buf, size_t len, int flags); - nBytesTotal = recv(obj->sid, obj->buffer, obj->bufferSize, 0); + nBytesTotal = recv(obj->sid, obj->buffer, obj->bufferSize, MSG_WAITALL); if (nBytesTotal == obj->bufferSize) { - printf("Received %d bytes", nBytesTotal); + rtnValue = 0; } else