/// <summary> /// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. /// </summary> public void Dispose() { if (connection != null && !connection.dropped) { connection.drop(Connection.DropReason.Destructing); connection = null; } }
public void Dispose() { dropping = true; if (retry_timer != null) { ROS.timer_manager.RemoveTimer(ref retry_timer); } connection.drop(Connection.DropReason.Destructing); }
public virtual void drop() { if (connection.sendingHeaderError) { connection.DroppedEvent -= onConnectionDropped; } else { connection.drop(Connection.DropReason.Destructing); } }
private void processNextCall() { bool empty = false; lock (call_queue_mutex) { if (current_call != null) { return; } if (call_queue.Count > 0) { current_call = call_queue.Dequeue(); } else { empty = true; } } if (empty) { if (persistent) { connection.drop(Connection.DropReason.Destructing); } } else { IRosMessage request; lock (call_queue_mutex) { request = current_call.req; } request.Serialize(); connection.write(request.Serialized, (uint)request.Serialized.Length, onRequestWritten); } }
private void onHeaderLengthRead(Connection conn, ref byte[] data, uint size, bool success) { if (conn != this) { throw new Exception("THAT EVENT IS NOT FOR MEEE!"); } if (size != 4) { throw new Exception("THAT SIZE ISN'T 4! SDKJSDLKJHSDLKJSHD"); } if (!success) { return; } uint len = BitConverter.ToUInt32(data, 0); if (len > 1000000000) { conn.drop(DropReason.HeaderError); } read(len, onHeaderRead); }
private void onHeaderLengthRead(Connection conn, ref byte[] data, uint size, bool success) { if (conn != this) throw new Exception("THAT EVENT IS NOT FOR MEEE!"); if (size != 4) throw new Exception("THAT SIZE ISN'T 4! SDKJSDLKJHSDLKJSHD"); if (!success) { return; } uint len = BitConverter.ToUInt32(data, 0); if (len > 1000000000) { conn.drop(DropReason.HeaderError); } read(len, onHeaderRead); }