public bool initialize(Connection connection) { if (parent != null) EDB.WriteLine("Init transport subscriber link: " + parent.Name); this.connection = connection; connection.DroppedEvent += onConnectionDropped; return true; }
private bool onErrorHeaderWritten(Connection conn) { drop(DropReason.HeaderError); return false; }
public bool initialize(Connection conn) { connection = conn; connection.DroppedEvent += onConnectionDropped; return true; }
public virtual void onResponseWritten(Connection conn) { if (conn != connection) throw new Exception("WRONG CONNECTION!"); if (persistent) connection.read(4, onRequestLength); else connection.drop(Connection.DropReason.Destructing); }
public virtual void onHeaderWritten(Connection conn) { connection.read(4, onRequestLength); }
public virtual void onRequest(Connection conn, ref byte[] buffer, uint size, bool success) { if (!success) return; if (conn != connection) throw new Exception("WRONG CONNECTION!"); if (parent != null) lock (parent) { parent.processRequest(ref buffer, size, this); } }
private void onMessageWritten(Connection conn) { writing_message = false; startMessageWrite(true); }
private void onErrorHeaderWritten(Connection conn) { drop(DropReason.HeaderError); }
private bool onMessageWritten(Connection conn) { writing_message = false; startMessageWrite(true); return true; }
private bool onHeaderWritten(Connection conn) { header_written = true; startMessageWrite(true); return true; }
public virtual bool onHeaderWritten(Connection conn) { connection.read(4, onRequestLength); return true; }
public bool initialize(Connection conn) { connection = conn; connection.DroppedEvent += onConnectionDropped; return(true); }
public virtual void onHeaderWritten(Connection conn) { connection.read(4, onRequestLength); }
private void onHeaderRead(Connection conn, ref byte[] data, uint size, bool success) { if (conn != this) throw new Exception("THAT EVENT IS NOT FOR MEEE!"); if (!success) { return; } string error_msg = ""; if (!header.Parse(data, (int) size, ref error_msg)) { drop(DropReason.HeaderError); } else { string error_val = ""; if (header.Values.Contains("error")) { error_val = (string) header.Values["error"]; EDB.WriteLine("Received error message in header for connection to [{0}]: [{1}]", "TCPROS connection to [" + transport.cached_remote_host + "]", error_val); drop(DropReason.HeaderError); } else { if (header_func == null) throw new Exception("AMG YOUR HEADERFUNC SUCKS"); transport.parseHeader(header); header_func(conn, header); } } }
private void onConnectionDropped(Connection conn, Connection.DropReason reason) { if (conn != connection || parent == null) return; lock (parent) { parent.removeServiceClientLink(this); } }
private void onHeaderWritten(Connection conn) { if (conn != this) throw new Exception("THAT EVENT IS NOT FOR MEEE!"); if (header_written_callback == null) throw new Exception( "NOBODY CARES ABOUT YOU, YOUR CHILDREN (neither present nor future), NOR YOUR GRANDCHILDREN (neither present nor future)"); header_written_callback(conn); header_written_callback = null; }
public virtual void onRequestLength(Connection conn, ref byte[] buffer, uint size, bool success) { if (!success) return; if (conn != connection || size != 4) throw new Exception("Invalid request length read"); uint len = BitConverter.ToUInt32(buffer, 0); if (len > 1000000000) { ROS.Error("A message over a gigabyte was predicted... stop... being... bad."); connection.drop(Connection.DropReason.Destructing); return; } connection.read(len, onRequest); }
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 onHeaderWritten(Connection conn) { header_written = true; startMessageWrite(true); }