Esempio n. 1
0
        private static void UVConnectCallback(IntPtr reqHandle, Int32 status)
        {
            var req      = FromIntPtr <UVConnectRquest>(reqHandle);
            var callback = req.mCallback;
            var state    = req.mState;


            UVException error = null;

            if (status < 0)
            {
                UVIntrop.Check(status, out error);
            }

            try
            {
                if (callback != null)
                {
                    callback(req, status, error, state);
                }
            }
            catch (Exception ex)
            {
                throw;
            }
            finally
            {
                req.Close();
            }
        }
Esempio n. 2
0
 /// <summary>
 /// 触发已发送
 /// </summary>
 /// <param name="status"></param>
 /// <param name="error"></param>
 public void RaiseSended(Int32 status, UVException error)
 {
     try
     {
         if (this.mWriteCallback != null)
         {
             this.mWriteCallback(this, status, error, this.mWriteCallbackState);
         }
     }
     catch (Exception ex)
     {
         this.mWriteCallback      = null;
         this.mWriteCallbackState = null;
         UnpinGCHandles();
         //Trace.Error("UvWriteCb", ex);
         throw;
     }
 }
Esempio n. 3
0
        private unsafe static void UVWriteCb(IntPtr reqHandle, Int32 status)
        {
            var req = FromIntPtr <UVWriteRequest>(reqHandle);

            UVException error = null;

            if (status < 0)
            {
                UVIntrop.Check(status, out error);
            }

            try
            {
                req.RaiseSended(status, error);
            }
            catch
            {
                throw;
            }
        }
Esempio n. 4
0
 public static void ip6_addr(string ip, int port, out SockAddr addr, out UVException error)
 {
     Check(uv_ip6_addr(ip, port, out addr), out error);
 }
Esempio n. 5
0
 public static void Check(int statusCode, out UVException error)
 {
     // Note: method is explicitly small so the success case is easily inlined
     error = statusCode < 0 ? GetError(statusCode) : null;
 }