connection.go
func (c *MConnection) TrySend(chID byte, msg interface{}) bool {
	if !c.IsRunning() {
		return false
	}

	log.Debug("TrySend", "channel", chID, "conn", c, "msg", msg)

	// Send message to channel.
	channel, ok := c.channelsIdx[chID]
	if !ok {
		log.Error(cmn.Fmt("Cannot send bytes, unknown channel %X", chID))
		return false
	}

	ok = channel.trySendBytes(wire.BinaryBytes(msg))
	if ok {
		// Wake up sendRoutine if necessary
		select {
		case c.send <- struct{}{}:
		default:
		}
	}

	return ok
}
func (c *MConnection) TrySend(chID byte, msg interface{}) bool {
	if !c.IsRunning() {
		return false
	}

	log.Debug("TrySend", "channel", chID, "conn", c, "msg", msg)

	// Send message to channel.
	channel, ok := c.channelsIdx[chID]
	if !ok {
		log.Error(cmn.Fmt("Cannot send bytes, unknown channel %X", chID))
		return false
	}

	ok = channel.trySendBytes(wire.BinaryBytes(msg))
	if ok {
		// Wake up sendRoutine if necessary
		select {
		case c.send <- struct{}{}:
		default:
		}
	}

	return ok
}
func ( c * MConnection ) TrySend ( chID byte , msg interface { } ) bool { if ! c . IsRunning ( ) { return false } log . Debug ( " " , " " , chID , " " , c , " " , msg ) // Send message to channel. channel , ok := c . channelsIdx [ chID ] if ! ok { log . Error ( cmn . Fmt ( " " , chID ) ) return false } ok = channel . trySendBytes ( wire . BinaryBytes ( msg ) ) if ok { // Wake up sendRoutine if necessary select { case c . send <- struct { } { } : default : } } return ok }
// Queues a message to be sent to channel.
// Nonblocking, returns true if successful.
Queues a message to be sent to channel . Nonblocking returns true if successful .