public static int ReadVariable(this Buffer self, out uint value) { return(Deserializer.ReadVariableInternal(self, out value)); }
public override void Deserialize(Deserializer deserializer) { base.Deserialize(deserializer); }
protected void OnReceiveFromInternal(int bytesTransferred, EndPoint endPoint) { Diag.AddBytesReceived(bytesTransferred); int handle; using (new ReadLock(rwlock)) { if (!reverseMap.TryGetValue(endPoint, out handle)) { handle = 0; } } rxBuffer.Stretch(bytesTransferred); if (BufferTransform != null) { try { BufferTransform.InverseTransform(rxBuffer, (int)rxBuffer.Length); } catch (Exception e) { Trace.Error("{0} {1} buffer inv transform error: {2}", Name, handle, e.Message); return; } } rxBuffer.Rewind(); var deserializer = new Deserializer(rxBuffer, EventFactory); int typeId; try { deserializer.Read(out typeId); } catch (System.IO.EndOfStreamException) { // Need more return; } Event retrieved = CreateEvent(typeId); if (ReferenceEquals(retrieved, null)) { Trace.Error("{0} {1} unknown event type id {2}", Name, handle, typeId); return; } else { try { retrieved.Deserialize(deserializer); } catch (Exception e) { Trace.Error("{0} {1} error loading event {2}: {3}", Name, handle, retrieved.GetTypeId(), e.ToString()); return; } if (handle != 0) { retrieved._Handle = handle; } Hub.Post(retrieved); Diag.IncrementEventsReceived(); Trace.Debug("{0} {1} received event {2}", Name, handle, retrieved); } }