Skip to content
This repository was archived by the owner on Jan 23, 2023. It is now read-only.

Commit 5a25cf9

Browse files
committed
Merge pull request #2915 from vijaykota/feature
HttpClient xplat: Fix bugs in polling and callback logic
2 parents 563f5de + 58178ce commit 5a25cf9

File tree

3 files changed

+5
-7
lines changed

3 files changed

+5
-7
lines changed

src/Common/src/Interop/Unix/libcurl/Interop.SafeCurlHandle.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ internal void PollFds(List<libc.pollfd> readyFds)
117117
// Whenever an fd is added/removed in _fdSet, a write happens to the
118118
// write end of the pipe thus causing the poll to return.
119119
pollFds[0].fd = _specialFds[libc.ReadEndOfPipe];
120-
pollFds[0].events = PollFlags.POLLIN | PollFlags.POLLOUT;
120+
pollFds[0].events = PollFlags.POLLIN;
121121
int i = 1;
122122
foreach (int fd in _fdSet)
123123
{
@@ -176,7 +176,6 @@ internal void PollFds(List<libc.pollfd> readyFds)
176176
internal void SignalFdSetChange(int fd, bool isRemove)
177177
{
178178
Debug.Assert(Monitor.IsEntered(this));
179-
180179
bool changed = isRemove ? _fdSet.Remove(fd) : _fdSet.Add(fd);
181180
if (!changed)
182181
{
@@ -227,6 +226,7 @@ private int ReadSpecialFd(PollFlags revents)
227226
{
228227
return -1;
229228
}
229+
Debug.Assert((revents & PollFlags.POLLIN) != 0);
230230
int pipeReadFd = _specialFds[libc.ReadEndOfPipe];
231231
int bytesRead = 0;
232232
unsafe

src/Common/src/Interop/Unix/libcurl/Interop.libcurl.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,13 @@ public static extern int curl_global_init(
2525
public static extern void curl_multi_cleanup(
2626
IntPtr handle);
2727

28-
[DllImport(Interop.Libraries.LibCurl, CharSet = CharSet.Ansi)]
28+
[DllImport(Interop.Libraries.LibCurl)]
2929
public static extern int curl_multi_setopt(
3030
SafeCurlMultiHandle multi_handle,
3131
int option,
3232
curl_socket_callback value);
3333

34-
[DllImport(Interop.Libraries.LibCurl, CharSet = CharSet.Ansi)]
34+
[DllImport(Interop.Libraries.LibCurl)]
3535
public static extern int curl_multi_setopt(
3636
SafeCurlMultiHandle multi_handle,
3737
int option,
@@ -155,5 +155,5 @@ public static extern void curl_slist_free_all(
155155

156156
[DllImport(Interop.Libraries.LibCurl)]
157157
public static extern IntPtr curl_version_info(int curlVersionStamp);
158-
}
158+
}
159159
}

src/System.Net.Http/src/System/Net/Http/Unix/CurlCallbacks.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -371,8 +371,6 @@ private static int CurlSocketCallback(
371371
}
372372
}
373373

374-
CheckForCompletedTransfers(state.SessionHandle);
375-
376374
return retVal;
377375
}
378376

0 commit comments

Comments
 (0)