Some debugging-related cleanups, Fixed memleak
This commit is contained in:
parent
4d02c92db5
commit
38b9f13bef
|
@ -4,6 +4,7 @@ D1X-Rebirth Changelog
|
|||
--------
|
||||
d1x.ini, include/args.h, main/args.c, main/inferno.c, main/menu.c: Added -ip_hostaddr argument to specify a host IP address via command-line/INI
|
||||
main/gameseq.c, main/menu.c: Fixes and improvements on -ip_hostaddr; Fixed paltte bug in SDL build
|
||||
main/ipbase.cpp, main/ipbase.h, main/ipclient.cpp, main/ipclient.h, main/multi.c: Some debugging-related cleanups, Fixed memleak
|
||||
|
||||
20070808
|
||||
--------
|
||||
|
|
|
@ -54,7 +54,9 @@ void ip_handshake_base::setstate(int newstate){
|
|||
if (newstate&STATE_NEED_RESEND)
|
||||
peer_list.pendinghandshakes++;
|
||||
}
|
||||
mprintf((0,"peer_list.pendinghandshakes=%i\n",peer_list.pendinghandshakes));
|
||||
#ifndef NDEBUG
|
||||
printf("peer_list.pendinghandshakes=%i\n",peer_list.pendinghandshakes);
|
||||
#endif
|
||||
}
|
||||
state=newstate;attempts=0;nextsend=0;
|
||||
}
|
||||
|
@ -197,7 +199,9 @@ ip_peer * ip_peer_list::add_full(ip_id id, u_int16_t iver,ip_addr_list &addrs){
|
|||
}*/
|
||||
n->addr.add(addrs);
|
||||
n->iver=iver;
|
||||
mprintf((0,"addfull %i addrs\n",n->addr.naddr));
|
||||
#ifndef NDEBUG
|
||||
printf("addfull %i addrs\n",n->addr.naddr);
|
||||
#endif
|
||||
// n->id=id;
|
||||
return n;
|
||||
}
|
||||
|
@ -426,13 +430,17 @@ void ip_receive_cfg(ubyte *buf,int buflen,ip_addr fromaddr){
|
|||
#endif
|
||||
p=peer_list.find_byid(hsr.id);
|
||||
if (!p) {
|
||||
mprintf((0,"relay from unknown peer\n"));
|
||||
#ifndef NDEBUG
|
||||
printf("relay from unknown peer\n");
|
||||
#endif
|
||||
break;//hrm.
|
||||
}
|
||||
rp=peer_list.find_byid(hsr.r_id);
|
||||
if (hsr.state&STATE_RELAYREPLY){
|
||||
if (!rp) {
|
||||
mprintf((0,"relay reply for unknown peer\n"));
|
||||
#ifndef NDEBUG
|
||||
printf("relay from unknown peer\n");
|
||||
#endif
|
||||
break;//hrm.
|
||||
}
|
||||
ip_handshake_relay *rhsr=p->find_relay(rp->id);
|
||||
|
@ -453,14 +461,17 @@ void ip_receive_cfg(ubyte *buf,int buflen,ip_addr fromaddr){
|
|||
rp->verify_addr(hsr.r_addr);
|
||||
|
||||
if (rp->addr.goodaddr==NULL){
|
||||
mprintf((0,"sending relayed handshake\n"));
|
||||
#ifndef NDEBUG
|
||||
printf("sending relayed handshake\n");
|
||||
#endif
|
||||
//handshake with relayed peer
|
||||
ip_handshake_info *lhsi=rp->find_handshake();
|
||||
// lhsi->setstate(STATE_INEEDINFO);
|
||||
if (lhsi->addstate(STATE_INEEDINFO));
|
||||
rp->send_handshake(lhsi);
|
||||
}else{
|
||||
mprintf((0,"sending relayed reply\n"));
|
||||
#ifndef NDEBUG
|
||||
printf("sending relayed reply\n");
|
||||
#endif
|
||||
//reply to relayer
|
||||
ip_handshake_relay rhsr(rp);
|
||||
rhsr.setstate(STATE_RELAYREPLY);
|
||||
|
|
|
@ -122,7 +122,9 @@ class ip_addr {
|
|||
if (l==6){
|
||||
memcpy(addr,buf+1,6);alen=l;
|
||||
}else{
|
||||
mprintf((0,"ip_addr readbuf bad len %i\n",l));
|
||||
#ifndef NDEBUG
|
||||
printf("ip_addr readbuf bad len %i\n",l);
|
||||
#endif
|
||||
memset(addr,0,6);alen=0;
|
||||
}
|
||||
return l+1;
|
||||
|
|
|
@ -57,8 +57,10 @@ int ip_connect_manual(char *textaddr) {
|
|||
// ip_send_handshake(hsr,&hsr->reply);
|
||||
while(hsi->state&STATE_VALID_STATES){
|
||||
r=ipx_get_packet_data(buf);
|
||||
if (r>0)
|
||||
mprintf((0,MSGHDR "ip_connect_manual: weird, someone sent us normal data\n"));
|
||||
#ifndef NDEBUG
|
||||
if (r>0)
|
||||
printf(MSGHDR "ip_connect_manual: weird, someone sent us normal data\n");
|
||||
#endif
|
||||
if (key_inkey()==KEY_ESC)
|
||||
return 0;
|
||||
}
|
||||
|
@ -183,7 +185,9 @@ static int ipx_ip_ReceivePacket(char *outbuf, int outbufsize,
|
|||
|
||||
if (memcmp(outbuf+0,D1Xid,2)) {
|
||||
if (memcmp(outbuf+0,D1Xcfgid,4)) {
|
||||
mprintf((0,MSGHDR"no valid header\n"));
|
||||
#ifndef NDEBUG
|
||||
printf(MSGHDR "no valid header\n");
|
||||
#endif
|
||||
return -1;
|
||||
}
|
||||
{
|
||||
|
|
|
@ -14,6 +14,7 @@ extern "C"{
|
|||
#include "ipx.h"
|
||||
#include "ipx_drv.h"
|
||||
#include "newmenu.h"
|
||||
#include "text.h"
|
||||
void ip_sendtoall(char *buf,int len);
|
||||
int ip_connect_manual(char *textaddr);//make it extern C so that it can be called from .c files.
|
||||
//void ip_portshift(ubyte*qhbuf,const char *cs);
|
||||
|
@ -49,7 +50,7 @@ static inline void msg(const char *fmt,...)
|
|||
putchar('\n');
|
||||
}
|
||||
|
||||
#define FAIL(m...) do{ nm_messagebox("Error", 1, "Ok", ##m); return -1; } while (0)
|
||||
#define FAIL(m...) do{ nm_messagebox(TXT_ERROR, 1, "Ok", ##m); return -1; } while (0)
|
||||
|
||||
static inline void chk(void *p){
|
||||
if (p) return;
|
||||
|
|
|
@ -3657,8 +3657,8 @@ network_i_am_master(void)
|
|||
|
||||
void change_playernum_to( int new_Player_num )
|
||||
{
|
||||
if (Player_num > -1)
|
||||
memcpy( Players[new_Player_num].callsign, Players[Player_num].callsign, CALLSIGN_LEN+1 );
|
||||
// if (Player_num > -1)
|
||||
// memcpy( Players[new_Player_num].callsign, Players[Player_num].callsign, CALLSIGN_LEN+1 );
|
||||
Player_num = new_Player_num;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue