mirror of
https://github.com/schoebel/mars
synced 2025-01-29 10:43:26 +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 sleeptime = 1000 / HZ;
|
||||
int status = -EIDRM;
|
||||
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);
|
||||
|
||||
if (status == -EAGAIN) {
|
||||
#if 0
|
||||
if (!done)
|
||||
goto err;
|
||||
#endif
|
||||
msleep(50);
|
||||
// linearly increasing backoff
|
||||
if (sleeptime < 100)
|
||||
sleeptime++;
|
||||
msleep(sleeptime);
|
||||
continue;
|
||||
}
|
||||
if (!status) { // EOF
|
||||
@ -372,6 +372,7 @@ int mars_recv(struct mars_socket *msock, void *buf, int minlen, int maxlen)
|
||||
goto err;
|
||||
}
|
||||
done += status;
|
||||
sleeptime = 1000 / HZ;
|
||||
}
|
||||
status = done;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user