|
@ -196,7 +196,7 @@ func (c *MConnection) Send(chID byte, msg interface{}) bool { |
|
|
return false |
|
|
return false |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
log.Info("Send", "channel", chID, "conn", c, "msg", msg) //, "bytes", wire.BinaryBytes(msg))
|
|
|
|
|
|
|
|
|
log.Debug("Send", "channel", chID, "conn", c, "msg", msg) //, "bytes", wire.BinaryBytes(msg))
|
|
|
|
|
|
|
|
|
// Send message to channel.
|
|
|
// Send message to channel.
|
|
|
channel, ok := c.channelsIdx[chID] |
|
|
channel, ok := c.channelsIdx[chID] |
|
@ -225,7 +225,7 @@ func (c *MConnection) TrySend(chID byte, msg interface{}) bool { |
|
|
return false |
|
|
return false |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
log.Info("TrySend", "channel", chID, "conn", c, "msg", msg) |
|
|
|
|
|
|
|
|
log.Debug("TrySend", "channel", chID, "conn", c, "msg", msg) |
|
|
|
|
|
|
|
|
// Send message to channel.
|
|
|
// Send message to channel.
|
|
|
channel, ok := c.channelsIdx[chID] |
|
|
channel, ok := c.channelsIdx[chID] |
|
@ -277,12 +277,12 @@ FOR_LOOP: |
|
|
channel.updateStats() |
|
|
channel.updateStats() |
|
|
} |
|
|
} |
|
|
case <-c.pingTimer.Ch: |
|
|
case <-c.pingTimer.Ch: |
|
|
log.Info("Send Ping") |
|
|
|
|
|
|
|
|
log.Debug("Send Ping") |
|
|
wire.WriteByte(packetTypePing, c.bufWriter, &n, &err) |
|
|
wire.WriteByte(packetTypePing, c.bufWriter, &n, &err) |
|
|
c.sendMonitor.Update(int(n)) |
|
|
c.sendMonitor.Update(int(n)) |
|
|
c.flush() |
|
|
c.flush() |
|
|
case <-c.pong: |
|
|
case <-c.pong: |
|
|
log.Info("Send Pong") |
|
|
|
|
|
|
|
|
log.Debug("Send Pong") |
|
|
wire.WriteByte(packetTypePong, c.bufWriter, &n, &err) |
|
|
wire.WriteByte(packetTypePong, c.bufWriter, &n, &err) |
|
|
c.sendMonitor.Update(int(n)) |
|
|
c.sendMonitor.Update(int(n)) |
|
|
c.flush() |
|
|
c.flush() |
|
@ -411,11 +411,11 @@ FOR_LOOP: |
|
|
switch pktType { |
|
|
switch pktType { |
|
|
case packetTypePing: |
|
|
case packetTypePing: |
|
|
// TODO: prevent abuse, as they cause flush()'s.
|
|
|
// TODO: prevent abuse, as they cause flush()'s.
|
|
|
log.Info("Receive Ping") |
|
|
|
|
|
|
|
|
log.Debug("Receive Ping") |
|
|
c.pong <- struct{}{} |
|
|
c.pong <- struct{}{} |
|
|
case packetTypePong: |
|
|
case packetTypePong: |
|
|
// do nothing
|
|
|
// do nothing
|
|
|
log.Info("Receive Pong") |
|
|
|
|
|
|
|
|
log.Debug("Receive Pong") |
|
|
case packetTypeMsg: |
|
|
case packetTypeMsg: |
|
|
pkt, n, err := msgPacket{}, int(0), error(nil) |
|
|
pkt, n, err := msgPacket{}, int(0), error(nil) |
|
|
wire.ReadBinaryPtr(&pkt, c.bufReader, maxMsgPacketTotalSize(), &n, &err) |
|
|
wire.ReadBinaryPtr(&pkt, c.bufReader, maxMsgPacketTotalSize(), &n, &err) |
|
|