Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-cw
Commits
1db22395
Commit
1db22395
authored
Jan 12, 2007
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
server: Set the specified in/out buffer sizes on named pipes using SO_SND/RCVBUF.
parent
ba313be7
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
33 additions
and
0 deletions
+33
-0
pipe.c
dlls/kernel32/tests/pipe.c
+22
-0
named_pipe.c
server/named_pipe.c
+11
-0
No files found.
dlls/kernel32/tests/pipe.c
View file @
1db22395
...
...
@@ -754,6 +754,8 @@ static void test_CreatePipe(void)
HANDLE
piperead
,
pipewrite
;
DWORD
written
;
DWORD
read
;
DWORD
i
,
size
;
BYTE
*
buffer
;
char
readbuf
[
32
];
pipe_attr
.
nLength
=
sizeof
(
SECURITY_ATTRIBUTES
);
...
...
@@ -764,6 +766,8 @@ static void test_CreatePipe(void)
ok
(
written
==
sizeof
(
PIPENAME
),
"Write to anonymous pipe wrote %d bytes
\n
"
,
written
);
ok
(
ReadFile
(
piperead
,
readbuf
,
sizeof
(
readbuf
),
&
read
,
NULL
),
"Read from non empty pipe failed
\n
"
);
ok
(
read
==
sizeof
(
PIPENAME
),
"Read from anonymous pipe got %d bytes
\n
"
,
read
);
ok
(
CloseHandle
(
pipewrite
),
"CloseHandle for the write pipe failed
\n
"
);
ok
(
CloseHandle
(
piperead
),
"CloseHandle for the read pipe failed
\n
"
);
/* Now write another chunk*/
ok
(
CreatePipe
(
&
piperead
,
&
pipewrite
,
&
pipe_attr
,
0
)
!=
0
,
"CreatePipe failed
\n
"
);
...
...
@@ -775,6 +779,24 @@ static void test_CreatePipe(void)
ok
(
read
==
sizeof
(
PIPENAME
),
"Read from anonymous pipe got %d bytes
\n
"
,
read
);
/* But now we need to get informed that the pipe is closed */
ok
(
ReadFile
(
piperead
,
readbuf
,
sizeof
(
readbuf
),
&
read
,
NULL
)
==
0
,
"Broken pipe not detected
\n
"
);
ok
(
CloseHandle
(
piperead
),
"CloseHandle for the read pipe failed
\n
"
);
/* Try bigger chunks */
size
=
32768
;
buffer
=
HeapAlloc
(
GetProcessHeap
(),
0
,
size
);
for
(
i
=
0
;
i
<
size
;
i
++
)
buffer
[
i
]
=
i
;
ok
(
CreatePipe
(
&
piperead
,
&
pipewrite
,
&
pipe_attr
,
size
)
!=
0
,
"CreatePipe failed
\n
"
);
ok
(
WriteFile
(
pipewrite
,
buffer
,
size
,
&
written
,
NULL
),
"Write to anonymous pipe failed
\n
"
);
ok
(
written
==
size
,
"Write to anonymous pipe wrote %d bytes
\n
"
,
written
);
/* and close the write end, read should still succeed*/
ok
(
CloseHandle
(
pipewrite
),
"CloseHandle for the Write Pipe failed
\n
"
);
memset
(
buffer
,
0
,
size
);
ok
(
ReadFile
(
piperead
,
buffer
,
size
,
&
read
,
NULL
),
"Read from broken pipe withe with pending data failed
\n
"
);
ok
(
read
==
size
,
"Read from anonymous pipe got %d bytes
\n
"
,
read
);
for
(
i
=
0
;
i
<
size
;
i
++
)
ok
(
buffer
[
i
]
==
(
BYTE
)
i
,
"invalid data %x at %x
\n
"
,
buffer
[
i
],
i
);
/* But now we need to get informed that the pipe is closed */
ok
(
ReadFile
(
piperead
,
readbuf
,
sizeof
(
readbuf
),
&
read
,
NULL
)
==
0
,
"Broken pipe not detected
\n
"
);
ok
(
CloseHandle
(
piperead
),
"CloseHandle for the read pipe failed
\n
"
);
}
START_TEST
(
pipe
)
...
...
server/named_pipe.c
View file @
1db22395
...
...
@@ -776,6 +776,17 @@ DECL_HANDLER(open_named_pipe)
if
((
res
!=
-
1
)
&&
is_overlapped
(
server
->
options
))
res
=
fcntl
(
fds
[
0
],
F_SETFL
,
O_NONBLOCK
);
if
(
pipe
->
insize
)
{
setsockopt
(
fds
[
0
],
SOL_SOCKET
,
SO_RCVBUF
,
&
pipe
->
insize
,
sizeof
(
pipe
->
insize
)
);
setsockopt
(
fds
[
1
],
SOL_SOCKET
,
SO_RCVBUF
,
&
pipe
->
insize
,
sizeof
(
pipe
->
insize
)
);
}
if
(
pipe
->
outsize
)
{
setsockopt
(
fds
[
0
],
SOL_SOCKET
,
SO_SNDBUF
,
&
pipe
->
outsize
,
sizeof
(
pipe
->
outsize
)
);
setsockopt
(
fds
[
1
],
SOL_SOCKET
,
SO_SNDBUF
,
&
pipe
->
outsize
,
sizeof
(
pipe
->
outsize
)
);
}
client
->
fd
=
create_anonymous_fd
(
&
pipe_client_fd_ops
,
fds
[
1
],
&
client
->
obj
);
server
->
fd
=
create_anonymous_fd
(
&
pipe_server_fd_ops
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment