public void postMessage(UInt64 connID, BufferT msgBuff) { //auto f = connections.find(connID); //assert(f != connections.end()); //auto & conn = f->second; ClientConnection conn = connections[connID]; Debug.Assert(conn.ref_id_at_client == connID); // self-consistency BufferT buff = platform.makeBuffer(); IPublishableComposer composer = platform.makePublishableComposer(buff); PublishableStateMessageHeader mh = new PublishableStateMessageHeader(); mh.type = PublishableStateMessageHeader.MsgType.connectionMessage; mh.priority = 0; // TODO: source mh.state_type_id_or_direction = (UInt64)PublishableStateMessageHeader.ConnMsgDirection.toServer; Debug.Assert(conn.ref_id_at_client == connID); mh.ref_id_at_subscriber = conn.ref_id_at_client; Debug.Assert(conn.ref_id_at_server != 0); mh.ref_id_at_publisher = conn.ref_id_at_server; GMQueue.helperComposePublishableStateMessageBegin(composer, mh); ReadIteratorT riter = msgBuff.getReadIterator(); composer.appendRaw(riter); GMQueue.helperComposePublishableStateMessageEnd(composer); //assert(transport != nullptr); transport.postMessage(buff); }
public static bool AreEqualIgnoreEol(BufferT left, BufferT right) { if (ReferenceEquals(left, right)) { return(true); } else if (left == null) { return(false); } else if (right == null) { return(false); } ReadIteratorT l = left.getReadIterator(); ReadIteratorT r = right.getReadIterator(); while (l.isData() && r.isData()) { // \r\n == \n if (l.getChar() == '\r' && r.getChar() == '\n') { l.inc(); if (!l.isData() || l.getChar() != '\n') { return(false); } } // \n == \r\n else if (l.getChar() == '\n' && r.getChar() == '\r') { r.inc(); if (!r.isData() || r.getChar() != '\n') { return(false); } } else if (l.getChar() != r.getChar()) { return(false); } l.inc(); r.inc(); } return(!l.isData() && !r.isData()); }
public void onMessage(BufferT buffer) { ReadIteratorT riter = buffer.getReadIterator(); IPublishableParser parser = platform.makePublishableParser(riter); onMessage(parser); }