async void Receive() { org.objectfabric.CLRBuff buff = (org.objectfabric.CLRBuff)org.objectfabric.CLRBuff.getOrCreate(); buff.position(org.objectfabric.Buff.getLargestUnsplitable()); try { int length = await ReceiveAsync(new ArraySegment <byte>(buff.array(), buff.position(), buff.remaining())); if (length > 0 && resumeRead()) { buff.limit(buff.position() + length); read(buff); suspendRead(); } Receive(); } catch (Exception ex) { Location.onError(this, ex.Message, true); } finally { if (org.objectfabric.Debug.ENABLED) { buff.@lock(buff.limit()); } buff.recycle(); } }
protected void Recycle(org.objectfabric.CLRBuff buff) { buff.recycle(); }