Example #1
0
 /// <summary>
 /// 如果Connection Close掉了 关闭tcp 否则保持Tcp socket长连接
 /// </summary>
 /// <param name="req"></param>
 /// <param name="iskeep"></param>
 private static void OnOwinCallCompleteCallback(RequestData req, bool iskeep)
 {
     if (!iskeep || !req.IsKeepAlive())//Connection 是否Close掉了
     {
         req.Socket.Dispose();
         req.SaveToPoll();
         return;
     }
     OwinHttpWorkerManage.Start((OwinSocket)req.Socket, req._preLoadedBody);
     req.SaveToPoll();
 }
Example #2
0
        private static void WriteCallBack(OwinSocket socket, int num, Exception ex, object obj)
        {
            RequestData requestData = obj as RequestData;

            if (requestData == null)
            {
                socket.Dispose();
                return;
            }
            if (!requestData.IsKeepAlive() || ex != null)
            {
                requestData.SaveToPoll();
                socket.Dispose();
                return;
            }
            byte[] preLoadedBody = requestData._preLoadedBody;
            requestData.SaveToPoll();
            OwinHttpWorkerManage.Start(socket, preLoadedBody);
        }