Example #1
0
func (r *inMemoryResponder) write(m *msg.Message) {
	b := make([]byte, msg.SizeofMessage)
	m.WriteTo(b)
	n, err := r.writer.Write(b)
	if err != nil {
		r.handleError(err.Error())
	}
	if n != msg.SizeofMessage {
		r.handleError(fmt.Sprintf("Write Error: Wrong sized message. Found %d, expecting %d", n, msg.SizeofMessage))
	}
}
Example #2
0
func (o *OrderNode) CopyTo(to *msg.Message) {
	to.Kind = o.Kind()
	to.Price = o.Price()
	to.Amount = o.Amount()
	to.TraderId = o.TraderId()
	to.TradeId = o.TradeId()
	to.StockId = o.StockId()
}
Example #3
0
func (m *M) completeNotCancelled(nc *pqueue.OrderNode) {
	ncm := msg.Message{}
	nc.CopyTo(&ncm)
	ncm.Kind = msg.NOT_CANCELLED
	m.Out.Write(ncm)
}
Example #4
0
func (m *M) completeCancelled(c *pqueue.OrderNode) {
	cm := msg.Message{}
	c.CopyTo(&cm)
	cm.Kind = msg.CANCELLED
	m.Out.Write(cm)
}