mirror of
https://github.com/solemnwarning/directplay-lite
synced 2024-12-30 16:45:37 +01:00
IDirectPlay8Peer: Debug messages when connecting to peers.
This commit is contained in:
parent
7cc4e85f6d
commit
638a52dcfd
@ -435,6 +435,8 @@ HRESULT DirectPlay8Peer::Connect(CONST DPN_APPLICATION_DESC* CONST pdnAppDesc, I
|
||||
return DPNERR_INVALIDHOSTADDRESS;
|
||||
}
|
||||
|
||||
log_printf("hostname = '%S'", hostname_value);
|
||||
|
||||
if(host_sp == CLSID_DP8SP_TCPIP)
|
||||
{
|
||||
struct in_addr hostname_addr;
|
||||
@ -475,6 +477,8 @@ HRESULT DirectPlay8Peer::Connect(CONST DPN_APPLICATION_DESC* CONST pdnAppDesc, I
|
||||
return DPNERR_INVALIDHOSTADDRESS;
|
||||
}
|
||||
|
||||
log_printf("port = %d", (int)(port_value));
|
||||
|
||||
r_port = port_value;
|
||||
}
|
||||
else{
|
||||
@ -3317,6 +3321,8 @@ void DirectPlay8Peer::io_peer_connected(std::unique_lock<std::mutex> &l, unsigne
|
||||
{
|
||||
/* TCP connection established. */
|
||||
|
||||
log_printf("peer_id %u TCP connection established", peer_id);
|
||||
|
||||
if(peer->state == Peer::PS_CONNECTING_HOST)
|
||||
{
|
||||
PacketSerialiser connect_host(DPLITE_MSGID_CONNECT_HOST);
|
||||
@ -3380,6 +3386,8 @@ void DirectPlay8Peer::io_peer_connected(std::unique_lock<std::mutex> &l, unsigne
|
||||
else{
|
||||
/* TCP connection failed. */
|
||||
|
||||
log_printf("peer_id %u TCP connection failed: %s", peer_id, win_strerror(error).c_str());
|
||||
|
||||
if(peer->state == Peer::PS_CONNECTING_HOST)
|
||||
{
|
||||
connect_fail(l, DPNERR_NOCONNECTION, NULL, 0);
|
||||
@ -3840,6 +3848,11 @@ bool DirectPlay8Peer::peer_connect(Peer::PeerState initial_state, uint32_t remot
|
||||
r_addr.sin_addr.s_addr = remote_ip;
|
||||
r_addr.sin_port = htons(remote_port);
|
||||
|
||||
char s_ip[16];
|
||||
inet_ntop(AF_INET, &(r_addr.sin_addr), s_ip, sizeof(s_ip));
|
||||
|
||||
log_printf("Initiating connection to %s:%d as peer_id %u", s_ip, (int)(remote_port), peer_id);
|
||||
|
||||
if(connect(peer->sock, (struct sockaddr*)(&r_addr), sizeof(r_addr)) != -1 || WSAGetLastError() != WSAEWOULDBLOCK)
|
||||
{
|
||||
closesocket(peer->sock);
|
||||
|
Loading…
x
Reference in New Issue
Block a user