#include "recv.h"
#include "recv.cmdline.h"
+#include "fd.h"
#include "error.h"
struct gengetopt_args_info conf;
INIT_RECV_ERRLISTS;
-__printf_2_3 void para_log(int ll, char* fmt,...)
+__printf_2_3 void para_log(int ll, const char* fmt,...)
{
va_list argp;
printf("available receivers: ");
for (i = 0; receivers[i].name; i++)
printf("%s%s", i? " " : "", receivers[i].name);
- printf("\nTry para_recv -r<receivername>:-h for help on <receivername>\n");
+ printf("\nTry\n\tpara_recv -r '<receivername> -h'\n"
+ "for help on <receivername>.\n");
exit(EXIT_SUCCESS);
}
return check_receiver_arg(conf.receiver_arg, receiver_num);
FD_ZERO(&rfds);
FD_ZERO(&wfds);
timeout.tv_sec = 0;
- timeout.tv_usec = 1000 * 1000;
+ timeout.tv_usec = 999 * 1000;
max = -1;
ret = r->pre_select(&rn, &rfds, &wfds, &timeout);
- max = MAX(max, ret);
+ max = PARA_MAX(max, ret);
- PARA_DEBUG_LOG("timeout: %lums\n", tv2ms(&timeout));
- ret = select(max + 1, &rfds, &wfds, NULL, &timeout);
+ PARA_DEBUG_LOG("timeout: %lums, max: %d\n", tv2ms(&timeout), max);
+ ret = para_select(max + 1, &rfds, &wfds, &timeout);
if (ret < 0) {
- if (errno == EINTR || errno == EAGAIN)
- goto recv;
ret = -E_RECV_SELECT;
goto out;
}