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
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
6 deletions
+12
-6
socket.c
dlls/ws2_32/socket.c
+12
-6
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,
...
@@ -6531,8 +6531,8 @@ static int WS2_recv_base( SOCKET s, LPWSABUF lpBuffers, DWORD dwBufferCount,
LPWSABUF
lpControlBuffer
)
LPWSABUF
lpControlBuffer
)
{
{
unsigned
int
i
,
options
;
unsigned
int
i
,
options
;
int
n
,
fd
,
err
;
int
n
,
fd
,
err
,
overlapped
;
struct
ws2_async
*
wsa
;
struct
ws2_async
*
wsa
,
localwsa
;
BOOL
is_blocking
;
BOOL
is_blocking
;
DWORD
timeout_start
=
GetTickCount
();
DWORD
timeout_start
=
GetTickCount
();
ULONG_PTR
cvalue
=
(
lpOverlapped
&&
((
ULONG_PTR
)
lpOverlapped
->
hEvent
&
1
)
==
0
)
?
(
ULONG_PTR
)
lpOverlapped
:
0
;
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,
...
@@ -6547,11 +6547,18 @@ static int WS2_recv_base( SOCKET s, LPWSABUF lpBuffers, DWORD dwBufferCount,
if
(
fd
==
-
1
)
return
SOCKET_ERROR
;
if
(
fd
==
-
1
)
return
SOCKET_ERROR
;
overlapped
=
(
lpOverlapped
||
lpCompletionRoutine
)
&&
!
(
options
&
(
FILE_SYNCHRONOUS_IO_ALERT
|
FILE_SYNCHRONOUS_IO_NONALERT
));
if
(
overlapped
||
dwBufferCount
>
1
)
{
if
(
!
(
wsa
=
HeapAlloc
(
GetProcessHeap
(),
0
,
FIELD_OFFSET
(
struct
ws2_async
,
iovec
[
dwBufferCount
])
)))
if
(
!
(
wsa
=
HeapAlloc
(
GetProcessHeap
(),
0
,
FIELD_OFFSET
(
struct
ws2_async
,
iovec
[
dwBufferCount
])
)))
{
{
err
=
WSAEFAULT
;
err
=
WSAEFAULT
;
goto
error
;
goto
error
;
}
}
}
else
wsa
=
&
localwsa
;
wsa
->
hSocket
=
SOCKET2HANDLE
(
s
);
wsa
->
hSocket
=
SOCKET2HANDLE
(
s
);
wsa
->
flags
=
*
lpFlags
;
wsa
->
flags
=
*
lpFlags
;
...
@@ -6588,8 +6595,7 @@ static int WS2_recv_base( SOCKET s, LPWSABUF lpBuffers, DWORD dwBufferCount,
...
@@ -6588,8 +6595,7 @@ static int WS2_recv_base( SOCKET s, LPWSABUF lpBuffers, DWORD dwBufferCount,
}
}
else
if
(
lpNumberOfBytesRecvd
)
*
lpNumberOfBytesRecvd
=
n
;
else
if
(
lpNumberOfBytesRecvd
)
*
lpNumberOfBytesRecvd
=
n
;
if
((
lpOverlapped
||
lpCompletionRoutine
)
&&
if
(
overlapped
)
!
(
options
&
(
FILE_SYNCHRONOUS_IO_ALERT
|
FILE_SYNCHRONOUS_IO_NONALERT
)))
{
{
IO_STATUS_BLOCK
*
iosb
=
lpOverlapped
?
(
IO_STATUS_BLOCK
*
)
lpOverlapped
:
&
wsa
->
local_iosb
;
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,
...
@@ -6673,14 +6679,14 @@ static int WS2_recv_base( SOCKET s, LPWSABUF lpBuffers, DWORD dwBufferCount,
}
}
TRACE
(
" -> %i bytes
\n
"
,
n
);
TRACE
(
" -> %i bytes
\n
"
,
n
);
HeapFree
(
GetProcessHeap
(),
0
,
wsa
);
if
(
wsa
!=
&
localwsa
)
HeapFree
(
GetProcessHeap
(),
0
,
wsa
);
release_sock_fd
(
s
,
fd
);
release_sock_fd
(
s
,
fd
);
_enable_event
(
SOCKET2HANDLE
(
s
),
FD_READ
,
0
,
0
);
_enable_event
(
SOCKET2HANDLE
(
s
),
FD_READ
,
0
,
0
);
return
0
;
return
0
;
error:
error:
HeapFree
(
GetProcessHeap
(),
0
,
wsa
);
if
(
wsa
!=
&
localwsa
)
HeapFree
(
GetProcessHeap
(),
0
,
wsa
);
release_sock_fd
(
s
,
fd
);
release_sock_fd
(
s
,
fd
);
WARN
(
" -> ERROR %d
\n
"
,
err
);
WARN
(
" -> ERROR %d
\n
"
,
err
);
WSASetLastError
(
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