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
1184fe90
Commit
1184fe90
authored
May 19, 2014
by
Bruno Jesus
Committed by
Alexandre Julliard
May 20, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ws2_32: Avoid memory allocation for simple receives.
parent
75221939
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
9 deletions
+15
-9
socket.c
dlls/ws2_32/socket.c
+15
-9
No files found.
dlls/ws2_32/socket.c
View file @
1184fe90
...
...
@@ -6531,8 +6531,8 @@ static int WS2_recv_base( SOCKET s, LPWSABUF lpBuffers, DWORD dwBufferCount,
LPWSABUF
lpControlBuffer
)
{
unsigned
int
i
,
options
;
int
n
,
fd
,
err
;
struct
ws2_async
*
wsa
;
int
n
,
fd
,
err
,
overlapped
;
struct
ws2_async
*
wsa
,
localwsa
;
BOOL
is_blocking
;
DWORD
timeout_start
=
GetTickCount
();
ULONG_PTR
cvalue
=
(
lpOverlapped
&&
((
ULONG_PTR
)
lpOverlapped
->
hEvent
&
1
)
==
0
)
?
(
ULONG_PTR
)
lpOverlapped
:
0
;
...
...
@@ -6547,11 +6547,18 @@ static int WS2_recv_base( SOCKET s, LPWSABUF lpBuffers, DWORD dwBufferCount,
if
(
fd
==
-
1
)
return
SOCKET_ERROR
;
if
(
!
(
wsa
=
HeapAlloc
(
GetProcessHeap
(),
0
,
FIELD_OFFSET
(
struct
ws2_async
,
iovec
[
dwBufferCount
])
)))
overlapped
=
(
lpOverlapped
||
lpCompletionRoutine
)
&&
!
(
options
&
(
FILE_SYNCHRONOUS_IO_ALERT
|
FILE_SYNCHRONOUS_IO_NONALERT
));
if
(
overlapped
||
dwBufferCount
>
1
)
{
err
=
WSAEFAULT
;
goto
error
;
if
(
!
(
wsa
=
HeapAlloc
(
GetProcessHeap
(),
0
,
FIELD_OFFSET
(
struct
ws2_async
,
iovec
[
dwBufferCount
])
)))
{
err
=
WSAEFAULT
;
goto
error
;
}
}
else
wsa
=
&
localwsa
;
wsa
->
hSocket
=
SOCKET2HANDLE
(
s
);
wsa
->
flags
=
*
lpFlags
;
...
...
@@ -6588,8 +6595,7 @@ static int WS2_recv_base( SOCKET s, LPWSABUF lpBuffers, DWORD dwBufferCount,
}
else
if
(
lpNumberOfBytesRecvd
)
*
lpNumberOfBytesRecvd
=
n
;
if
((
lpOverlapped
||
lpCompletionRoutine
)
&&
!
(
options
&
(
FILE_SYNCHRONOUS_IO_ALERT
|
FILE_SYNCHRONOUS_IO_NONALERT
)))
if
(
overlapped
)
{
IO_STATUS_BLOCK
*
iosb
=
lpOverlapped
?
(
IO_STATUS_BLOCK
*
)
lpOverlapped
:
&
wsa
->
local_iosb
;
...
...
@@ -6673,14 +6679,14 @@ static int WS2_recv_base( SOCKET s, LPWSABUF lpBuffers, DWORD dwBufferCount,
}
TRACE
(
" -> %i bytes
\n
"
,
n
);
HeapFree
(
GetProcessHeap
(),
0
,
wsa
);
if
(
wsa
!=
&
localwsa
)
HeapFree
(
GetProcessHeap
(),
0
,
wsa
);
release_sock_fd
(
s
,
fd
);
_enable_event
(
SOCKET2HANDLE
(
s
),
FD_READ
,
0
,
0
);
return
0
;
error:
HeapFree
(
GetProcessHeap
(),
0
,
wsa
);
if
(
wsa
!=
&
localwsa
)
HeapFree
(
GetProcessHeap
(),
0
,
wsa
);
release_sock_fd
(
s
,
fd
);
WARN
(
" -> ERROR %d
\n
"
,
err
);
WSASetLastError
(
err
);
...
...
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