Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions ircDDBGateway/Common/G2ProtocolHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,18 @@ CAMBEData* CG2ProtocolHandler::readAMBE()
return data;
}

void CG2ProtocolHandler::PunchUDPHole(const wxString& address)
{
unsigned char buffer[1];
::memset(buffer, 0, 1);

in_addr addr = CUDPReaderWriter::lookup(address);

//wxLogError(wxT("Punching hole to %s"), address.mb_str());

m_socket.write(buffer, 1, addr, G2_DV_PORT);
}

void CG2ProtocolHandler::close()
{
m_socket.close();
Expand Down
2 changes: 2 additions & 0 deletions ircDDBGateway/Common/G2ProtocolHandler.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ class CG2ProtocolHandler {
CHeaderData* readHeader();
CAMBEData* readAMBE();

void PunchUDPHole(const wxString& addr);

void close();

private:
Expand Down
3 changes: 3 additions & 0 deletions ircDDBGateway/ircDDBGateway/IRCDDBGatewayThread.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -728,6 +728,7 @@ void CIRCDDBGatewayThread::processIrcDDB()
if (!address.IsEmpty()) {
wxLogMessage(wxT("USER: %s %s %s %s"), user.c_str(), repeater.c_str(), gateway.c_str(), address.c_str());
m_cache.updateUser(user, repeater, gateway, address, timestamp, DP_DEXTRA, false, false);
m_g2Handler->PunchUDPHole(address);
} else {
wxLogMessage(wxT("USER: %s NOT FOUND"), user.c_str());
}
Expand All @@ -744,6 +745,7 @@ void CIRCDDBGatewayThread::processIrcDDB()
if (!address.IsEmpty()) {
wxLogMessage(wxT("REPEATER: %s %s %s"), repeater.c_str(), gateway.c_str(), address.c_str());
m_cache.updateRepeater(repeater, gateway, address, DP_DEXTRA, false, false);
m_g2Handler->PunchUDPHole(address);
} else {
wxLogMessage(wxT("REPEATER: %s NOT FOUND"), repeater.c_str());
}
Expand All @@ -761,6 +763,7 @@ void CIRCDDBGatewayThread::processIrcDDB()
if (!address.IsEmpty()) {
wxLogMessage(wxT("GATEWAY: %s %s"), gateway.c_str(), address.c_str());
m_cache.updateGateway(gateway, address, DP_DEXTRA, false, false);
m_g2Handler->PunchUDPHole(address);
} else {
wxLogMessage(wxT("GATEWAY: %s NOT FOUND"), gateway.c_str());
}
Expand Down