curl_shim_multi_info_free() private method

private curl_shim_multi_info_free ( IntPtr multiInfo ) : void
multiInfo System.IntPtr
return void
Esempio n. 1
0
        /// <summary>
        ///     Obtain status information for a CurlMulti transfer. Requires
        ///     CurlSharp be compiled with the libcurlshim helper.
        /// </summary>
        /// <returns>
        ///     An array of <see cref="CurlMultiInfo" /> objects, one for each
        ///     <see cref="CurlEasy" /> object child.
        /// </returns>
        /// <exception cref="System.NullReferenceException">
        ///     This is thrown if the native <c>CurlMulti</c> handle wasn't
        ///     created successfully.
        /// </exception>
        public CurlMultiInfo[] InfoRead()
        {
            if (_bGotMultiInfo)
            {
                return(_multiInfo);
            }

#if USE_LIBCURLSHIM
            var nMsgs = 0;
            var pInfo = NativeMethods.curl_shim_multi_info_read(_pMulti, ref nMsgs);
            if (pInfo != IntPtr.Zero)
            {
                _multiInfo = new CurlMultiInfo[nMsgs];
                for (var i = 0; i < nMsgs; i++)
                {
                    var msg   = (CurlMessage)Marshal.ReadInt32(pInfo, i * 12);
                    var pEasy = Marshal.ReadIntPtr(pInfo, i * 12 + 4);
                    var code  = (CurlCode)Marshal.ReadInt32(pInfo, i * 12 + 8);
                    _multiInfo[i] = new CurlMultiInfo(msg, (CurlEasy)_htEasy[pEasy], code);
                }
                NativeMethods.curl_shim_multi_info_free(pInfo);
            }
            _bGotMultiInfo = true;
#else
            _multiInfo = null;
            throw new NotImplementedException("CurlMulti.InfoRead()");
#endif
            return(_multiInfo);
        }