Add host name
This commit is contained in:
parent
2cd8ef5558
commit
64364bfefd
@ -16,6 +16,7 @@
|
||||
#define DATA_FILE_NAME "DATA.bin"
|
||||
#define VECTOR_FILE_NAME "VECTOR.bin"
|
||||
#define GEN_FILE_PATTRN "gen/%04d.bin"
|
||||
#define HOST_NAME "petrovv.com"
|
||||
|
||||
void DnaStore::load(DnaManagerData *data)
|
||||
{
|
||||
@ -149,24 +150,24 @@ void DnaStore::saveGen(DnaManagerData *data)
|
||||
sync();
|
||||
}
|
||||
|
||||
void client(std::string prefix);
|
||||
void client(std::string_view prefix);
|
||||
|
||||
void DnaStore::sync()
|
||||
{
|
||||
const char *prefix = sys::transformFilePath("");
|
||||
std::string prefixs = prefix;
|
||||
std::string_view prefixs = prefix;
|
||||
|
||||
std::thread t(client, prefixs);
|
||||
t.detach();
|
||||
}
|
||||
|
||||
void client(std::string prefix)
|
||||
void client(std::string_view prefix)
|
||||
{
|
||||
constexpr int extra_buff = 22; // len of 2**31 -> 2147483648 plus the pattern size
|
||||
std::string buffer;
|
||||
buffer.resize(prefix.size() + extra_buff);
|
||||
|
||||
int sock = TcpSocket::connectt("petrovv.com", keyPort);
|
||||
int sock = TcpSocket::connectt(HOST_NAME, keyPort);
|
||||
if (sock < 0)
|
||||
{
|
||||
return;
|
||||
@ -177,7 +178,7 @@ void client(std::string prefix)
|
||||
|
||||
TcpSocket::closet(sock);
|
||||
|
||||
sock = TcpSocket::connectt("petrovv.com", serverPort);
|
||||
sock = TcpSocket::connectt(HOST_NAME, serverPort);
|
||||
|
||||
if (sock < 0)
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user