#include <errno.h>
#include <sys/socket.h>
#include <sys/ioctl.h>
+#include <sys/time.h>
#include <net/if.h>
#include <netdb.h>
#include "libnfs.h"
struct sockaddr *sin;
char hostdd[16];
+ if (status == RPC_STATUS_CANCEL) {
+ return;
+ }
if (status != 0) {
printf("callback for CALLIT failed\n");
exit(10);
struct pollfd pfd;
struct ifconf ifc;
int i, size;
+ struct timeval tv_start, tv_current;
rpc = rpc_init_udp_context();
if (rpc == NULL) {
}
free(ifc.ifc_buf);
-
- alarm(3);
-
+ gettimeofday(&tv_start, NULL);
for(;;) {
+ int mpt;
+
pfd.fd = rpc_get_fd(rpc);
pfd.events = rpc_which_events(rpc);
- if (poll(&pfd, 1, -1) < 0) {
+ gettimeofday(&tv_current, NULL);
+ mpt = 1000
+ - (tv_current.tv_sec *1000 + tv_current.tv_usec / 1000)
+ + (tv_start.tv_sec *1000 + tv_start.tv_usec / 1000);
+
+ if (poll(&pfd, 1, mpt) < 0) {
printf("Poll failed");
exit(10);
}
+ if (pfd.revents == 0) {
+ break;
+ }
+
if (rpc_service(rpc, pfd.revents) < 0) {
printf("rpc_service failed with %s\n", rpc_get_error(rpc));
break;
rpc_destroy_context(rpc);
rpc=NULL;
- printf("nfsclient finished\n");
return 0;
}