improve network responsiveness

This commit is contained in:
Thomas Schoebel-Theuer 2011-11-16 12:20:30 +01:00 committed by Thomas Schoebel-Theuer
parent 227d9061fb
commit e6bbb27cab

View File

@ -322,6 +322,7 @@ EXPORT_SYMBOL_GPL(mars_send);
int mars_recv(struct mars_socket *msock, void *buf, int minlen, int maxlen) int mars_recv(struct mars_socket *msock, void *buf, int minlen, int maxlen)
{ {
int sleeptime = 1000 / HZ;
int status = -EIDRM; int status = -EIDRM;
int done = 0; int done = 0;
@ -355,11 +356,10 @@ int mars_recv(struct mars_socket *msock, void *buf, int minlen, int maxlen)
status = kernel_recvmsg(msock->s_socket, &msg, &iov, 1, maxlen-done, msg.msg_flags); status = kernel_recvmsg(msock->s_socket, &msg, &iov, 1, maxlen-done, msg.msg_flags);
if (status == -EAGAIN) { if (status == -EAGAIN) {
#if 0 // linearly increasing backoff
if (!done) if (sleeptime < 100)
goto err; sleeptime++;
#endif msleep(sleeptime);
msleep(50);
continue; continue;
} }
if (!status) { // EOF if (!status) { // EOF
@ -372,6 +372,7 @@ int mars_recv(struct mars_socket *msock, void *buf, int minlen, int maxlen)
goto err; goto err;
} }
done += status; done += status;
sleeptime = 1000 / HZ;
} }
status = done; status = done;