public HyperPipe(int poolSize, IRequestProvider <T> requestProvider, IResponseConsumer <T> responseConsumer) { _requestProvider = requestProvider; _responseConsumer = responseConsumer; _easyPool = new EasyPool <T>(poolSize); _multiHandle = CurlNative.Multi.Init(); if (_multiHandle.IsInvalid) { throw new Exception("Could not init curl_multi handle."); } _socketMap = new SocketPollMap(); _loop = new Loop(); _timeout = _loop.CreateTimer(); // Explicitly define callback functions to keep them from being GCed. _socketCallback = HandleSocket; _timerCallback = StartTimeout; Logger.LogDebug($"Set {CURLMoption.SOCKETFUNCTION}."); CurlNative.Multi.SetOpt(_multiHandle, CURLMoption.SOCKETFUNCTION, _socketCallback); Logger.LogDebug($"Set {CURLMoption.TIMERFUNCTION}."); CurlNative.Multi.SetOpt(_multiHandle, CURLMoption.TIMERFUNCTION, _timerCallback); }
public static extern CURLMcode SocketAction(SafeMultiHandle multiHandle, SafeSocketHandle sockfd, CURLcselect evBitmask, out int runningHandles);
public static extern IntPtr InfoRead(SafeMultiHandle multiHandle, out int msgsInQueue);
public static extern CURLMcode SetOpt(SafeMultiHandle multiHandle, CURLMoption option, int value);
public static extern CURLMcode RemoveHandle(SafeMultiHandle multiHandle, SafeEasyHandle easyHandle);
public static extern CURLMcode SetOpt(SafeMultiHandle multiHandle, CURLMoption option, SocketCallback value);