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