mirror of
https://github.com/schoebel/mars
synced 2025-01-30 20:01:46 +00:00
improve network responsiveness
This commit is contained in:
parent
227d9061fb
commit
e6bbb27cab
11
mars_net.c
11
mars_net.c
@ -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;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user