- read may return partial content from a socket, deal with that
This commit is contained in:
+18
-2
@@ -44,7 +44,22 @@ static inline int GET(int s, void *out, int count)
|
|||||||
|
|
||||||
#else /* T_USE_SHARED_MEMORY */
|
#else /* T_USE_SHARED_MEMORY */
|
||||||
|
|
||||||
#define GET read
|
#define GET fullread
|
||||||
|
|
||||||
|
int fullread(int fd, void *_buf, int count)
|
||||||
|
{
|
||||||
|
char *buf = _buf;
|
||||||
|
int ret = 0;
|
||||||
|
int l;
|
||||||
|
while (count) {
|
||||||
|
l = read(fd, buf, count);
|
||||||
|
if (l <= 0) { printf("read socket problem\n"); abort(); }
|
||||||
|
count -= l;
|
||||||
|
buf += l;
|
||||||
|
ret += l;
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
#endif /* T_USE_SHARED_MEMORY */
|
#endif /* T_USE_SHARED_MEMORY */
|
||||||
|
|
||||||
@@ -236,7 +251,8 @@ void get_message(int s)
|
|||||||
buf[11],buf[12],buf[13],buf[14],buf[15]);
|
buf[11],buf[12],buf[13],buf[14],buf[15]);
|
||||||
#endif
|
#endif
|
||||||
if (size != 4 * 7680)
|
if (size != 4 * 7680)
|
||||||
{printf("bad T_ENB_INPUT_SIGNAL, only 7680 samples allowed\n");abort();}
|
{printf("bad T_ENB_INPUT_SIGNAL, only 7680 samples allowed "
|
||||||
|
"(received %d bytes = %d samples)\n", size, size/4);abort();}
|
||||||
if (ul_plot) iq_plot_set(ul_plot, (short*)buf, 7680, subframe*7680, 0);
|
if (ul_plot) iq_plot_set(ul_plot, (short*)buf, 7680, subframe*7680, 0);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user