倒霉的RakNet注释和代码不一致

最近做的东西底层传输用了RakNet,今儿在测试其ConnectionGraph2插件的时候很是不爽。这是相关的几个MessageID及代码中的注释(3.715版本,不是最新的也差不多了):

 

MessageID
1     /// ConnectionGraph plugin - In a client/server environment, a client other than ourselves has disconnected gracefully.  Packet::systemAddress is modified to reflect the systemAddress of this client.
2     ID_REMOTE_DISCONNECTION_NOTIFICATION,
3     /// ConnectionGraph plugin - In a client/server environment, a client other than ourselves has been forcefully dropped. Packet::systemAddress is modified to reflect the systemAddress of this client.
4     ID_REMOTE_CONNECTION_LOST,
5     /// ConnectionGraph plugin - In a client/server environment, a client other than ourselves has connected.  Packet::systemAddress is modified to reflect the systemAddress of the client that is not connected directly to us. The packet encoding is SystemAddress 1, ConnectionGraphGroupID 1, SystemAddress 2, ConnectionGraphGroupID 2
6     /// ConnectionGraph2 plugin: Bytes 1-4 = count. for (count items) contains {SystemAddress, RakNetGUID}
7     ID_REMOTE_NEW_INCOMING_CONNECTION,


其中ID_REMOTE_NEW_INCOMING_CONNECTION的注释区分了ConnectionGraph插件版本1和2的区别,验证是没错的;但是其他两个ID的注释和现在版本的代码是不一致的。注释中指出Packet结构的systemAddress成员被修改为丢失连接的客户端的地址,而事实上和其他包一样,这个成员是包发送端的地址,具体到这两条消息的情形,多半是服务器地址。而丢失连接的客户端地址在data成员中,格式为{MessageID, SystemAddress, RakNetGUID}。

 

刚刚测试得出的结果,查看官方示例代码与上述结果一致,及时记录下来,以备后查。

posted @ 2009-12-22 23:25  tonyyang132  阅读(403)  评论(0编辑  收藏  举报