private void PushDataExtend() { try { //推送数据 foreach (var item in SPM) { lock (item.Key) { var mc = item.Key.Split('_'); var mn = int.Parse(mc[0]); var cn = int.Parse(mc[1]); var data_push = item.Value; if (mc.Length == 3) { var userid = Convert.ToInt64(mc[2]); var _p = new PushSendOtherPlayer { user_id = userid, mn = mn, cn = cn, data = data_push, key = item.Key }; var token_test = new CancellationTokenSource(); Task.Factory.StartNew(m => { var temp = m as PushSendOtherPlayer; if (temp == null) { return; } OtherSessionPush(temp.user_id, temp.mn, temp.cn, temp.data); ASObject _obj; SPM.TryRemove(temp.key, out _obj); token_test.Cancel(); }, _p, token_test.Token); } else { var pv_push = InitProtocol(mn, cn, (int)ResponseType.TYPE_SUCCESS, data_push); SendData(pv_push, false); } } } SPM.Clear(); } catch (Exception ex) { XTrace.WriteException(ex); } }