mirror of
https://github.com/samba-team/samba.git
synced 2024-12-25 23:21:54 +03:00
r3318: generate random STATUS_MORE_ENTRIES errors (1 in 10 packets) as well
as randomly short recv/send when socket:testnonblock is enabled
(This used to be commit 718175a265
)
This commit is contained in:
parent
4a25682214
commit
8c752ec861
@ -158,7 +158,11 @@ NTSTATUS socket_recv(struct socket_context *sock, void *buf,
|
||||
}
|
||||
|
||||
if ((sock->flags & SOCKET_FLAG_TESTNONBLOCK) && wantlen > 1) {
|
||||
return sock->ops->recv(sock, buf, 1+(random() % (wantlen-1)), nread, flags);
|
||||
if (random() % 10 == 0) {
|
||||
*nread = 0;
|
||||
return STATUS_MORE_ENTRIES;
|
||||
}
|
||||
return sock->ops->recv(sock, buf, 1+(random() % wantlen), nread, flags);
|
||||
}
|
||||
|
||||
return sock->ops->recv(sock, buf, wantlen, nread, flags);
|
||||
@ -182,7 +186,11 @@ NTSTATUS socket_send(struct socket_context *sock,
|
||||
|
||||
if ((sock->flags & SOCKET_FLAG_TESTNONBLOCK) && blob->length > 1) {
|
||||
DATA_BLOB blob2 = *blob;
|
||||
blob2.length = 1+(random() % (blob2.length-1));
|
||||
if (random() % 10 == 0) {
|
||||
*sendlen = 0;
|
||||
return STATUS_MORE_ENTRIES;
|
||||
}
|
||||
blob2.length = 1+(random() % blob2.length);
|
||||
return sock->ops->send(sock, &blob2, sendlen, flags);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user