private void CheckCall(IZmqPool pool, int idx) { if (!pool.CheckIn(idx, out var message)) { return; } try { using (message) { if (!ZeroApplication.ZerCenterIsRun) { using (var res = new ZMessage { message[1].Duplicate(), new ZFrame(NetErrorDescription) }) { pool.Sockets[idx].SendMessage(res, out var error); } } bool success; using (ZMessage clone = new ZMessage()) { for (var index = 1; index < message.Count; index++) { clone.Add(message[index].Duplicate()); } success = pool.Sockets[idx + 1].SendMessage(clone, out var error2); } if (!success) { using (var res = new ZMessage { message[1].Duplicate(), new ZFrame(NetErrorDescription) }) { pool.Sockets[idx].SendMessage(res, out var error); } } else { ++WaitCount; } } } catch (Exception e) { ZeroTrace.WriteException("ConnectionProxy", e, "CheckCall"); } }
private void CheckCall(IZmqPool pool) { if (!pool.CheckIn(0, out var message)) { return; } try { using (message) { if (!ZeroApplication.ZerCenterIsRun) { using (var res = new ZMessage { message[1].Duplicate(), new ZFrame(NetErrorDescription) }) { _inprocPollSocket.SendMessage(res, out _); } } bool success; using (ZMessage clone = new ZMessage()) { for (var index = 1; index < message.Count; index++) { clone.Add(message[index].Duplicate()); } success = _callPollSocket.SendMessage(clone, out _); } if (!success) { using (var res = new ZMessage { message[1].Duplicate(), new ZFrame(NetErrorDescription) }) { _inprocPollSocket.SendMessage(res, out _); } } else { ++WaitCount; } } } catch (Exception e) { ZeroTrace.WriteException(Config.Name, e, "CheckCall"); } }
private void CheckResult(IZmqPool pool, int idx) { if (!pool.CheckIn(idx, out var message)) { return; } try { using (message) { using (ZMessage clone = new ZMessage()) { byte[] des = message[0].Read(); int size = des[0] + 2; for (var index = 2; index < size && index < des.Length; index++) { if (des[index] != ZeroFrameType.Requester) { continue; } clone.Add(message[index - 1].Duplicate()); break; } //clone.Add(new ZFrame("".ToAsciiBytes())); clone.Add(new ZFrame(des)); for (var index = 1; index < message.Count; index++) { clone.Add(message[index].Duplicate()); } pool.Sockets[idx - 1].SendMessage(clone, out _); --WaitCount; } } } catch (Exception e) { ZeroTrace.WriteException("ConnectionProxy", e, "CheckResult"); } }