forked from ddnet/ddnet
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request ddnet#7360 from Robyt3/Engine-Host-Lookup-Split
Move `CHostLookup` to separate compilation unit and encapsulate member variables
- Loading branch information
Showing
9 changed files
with
71 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
/* (c) Magnus Auvinen. See licence.txt in the root of the distribution for more information. */ | ||
/* If you are missing that file, acquire a complete release at teeworlds.com. */ | ||
|
||
#include "host_lookup.h" | ||
|
||
#include <base/system.h> | ||
|
||
CHostLookup::CHostLookup() = default; | ||
|
||
CHostLookup::CHostLookup(const char *pHostname, int Nettype) | ||
{ | ||
str_copy(m_aHostname, pHostname); | ||
m_Nettype = Nettype; | ||
} | ||
|
||
void CHostLookup::Run() | ||
{ | ||
m_Result = net_host_lookup(m_aHostname, &m_Addr, m_Nettype); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
/* (c) Magnus Auvinen. See licence.txt in the root of the distribution for more information. */ | ||
/* If you are missing that file, acquire a complete release at teeworlds.com. */ | ||
#ifndef ENGINE_SHARED_HOST_LOOKUP_H | ||
#define ENGINE_SHARED_HOST_LOOKUP_H | ||
|
||
#include <base/system.h> | ||
|
||
#include <engine/shared/jobs.h> | ||
|
||
class CHostLookup : public IJob | ||
{ | ||
private: | ||
int m_Result; | ||
char m_aHostname[128]; | ||
int m_Nettype; | ||
NETADDR m_Addr; | ||
|
||
void Run() override; | ||
|
||
public: | ||
CHostLookup(); | ||
CHostLookup(const char *pHostname, int Nettype); | ||
|
||
int Result() const { return m_Result; } | ||
const char *Hostname() const { return m_aHostname; } | ||
int Nettype() const { return m_Nettype; } | ||
NETADDR Addr() const { return m_Addr; } | ||
}; | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters