| 1567 | msg->setSendTimeout(SEND_TIMEOUT); |
| 1568 | msg->setData((unsigned8*)buffer, bufferSize); |
| 1569 | msg->send(); |
| 1570 | } |
| 1571 | msgID = (DWORD)msg->id; |
| 1572 | #ifdef NET_LOG_CLIENT_SEND |
| 1573 | NetLog("Channel(%u): NetClient::SendMsg: len=%3d, flags=%x, msgID=%x, hdr=%08x%08x", channel->getChannelId(), |
| 1574 | bufferSize, (unsigned)flags, msgID, ((unsigned*)msg->getData())[0], ((unsigned*)msg->getData())[1]); |
| 1575 | #endif |
| 1576 | leaveSnd(); |
| 1577 | return true; |
| 1578 | } |
| 1579 | |
| 1580 | bool NetClient::SendRawMagic(int magic, BYTE* buffer, int bufferSize) |
| 1581 | { |
| 1582 | enterSnd(); |
| 1583 | NetPeer* peer = getClientPeer(); |
| 1584 | bool ok = SendRawMagicPacket(peer, channel, rawMagicSerial, magic, buffer, bufferSize); |
| 1585 | leaveSnd(); |
| 1586 | return ok; |
| 1587 | } |
| 1588 | |
| 1589 | void NetClient::GetSendQueueInfo(int& nMsg, int& nBytes, int& nMsgG, int& nBytesG) |
| 1590 | { |
| 1591 | nMsg = nBytes = nMsgG = nBytesG = 0; |
| 1592 | } |
| 1593 | |
| 1594 | bool NetClient::GetConnectionInfo(int& latencyMS, int& throughputBPS) |
| 1595 | { |
| 1596 | enterSnd(); |
| 1597 | if (!channel) |
| 1598 | { |
| 1599 | leaveSnd(); |
| 1600 | return false; |
| 1601 | } |
| 1602 | latencyMS = (int)(channel->getLatency() / 1000); |
| 1603 | throughputBPS = (int)channel->getOutputBandWidth(); |
| 1604 | ; |
| 1605 | #ifdef NET_LOG_INFO |
| 1606 | if (latencyMS != oldLatency || throughputBPS != oldThroughput) |
| 1607 | { |
| 1608 | NetLog("Channel(%u): NetClient::GetConnectionInfo: %d ms,%d B/s", channel->getChannelId(), latencyMS, |
| 1609 | throughputBPS); |
| 1610 | oldLatency = latencyMS; |
| 1611 | oldThroughput = throughputBPS; |
| 1612 | printAge = true; |
| 1613 | } |
| 1614 | #endif |
| 1615 | leaveSnd(); |
| 1616 | return true; |
| 1617 | } |
| 1618 | |
| 1619 | template <class Type> |
| 1620 | Type LoadValue(const ParamEntry& cfg, const char* name, const Type& defVal) |
| 1621 | { |
| 1622 | const ParamEntry* entry = cfg.FindEntry(name); |
| 1623 | if (!entry) |
| 1624 | { |
| 1625 | return defVal; |
| 1626 | } |
no test coverage detected