mirror of
https://github.com/BeamMP/BeamMP-Launcher.git
synced 2025-07-01 23:46:59 +00:00
remove 'D' socket initialization code
This commit is contained in:
parent
3297b3e62e
commit
6a23518eff
@ -194,31 +194,6 @@ void MultiKill(SOCKET Sock, SOCKET Sock1) {
|
|||||||
KillSocket(Sock);
|
KillSocket(Sock);
|
||||||
Terminate = true;
|
Terminate = true;
|
||||||
}
|
}
|
||||||
SOCKET InitDSock() {
|
|
||||||
SOCKET DSock = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
|
|
||||||
SOCKADDR_IN ServerAddr;
|
|
||||||
if (DSock < 1) {
|
|
||||||
KillSocket(DSock);
|
|
||||||
Terminate = true;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
ServerAddr.sin_family = AF_INET;
|
|
||||||
ServerAddr.sin_port = htons(LastPort);
|
|
||||||
inet_pton(AF_INET, LastIP.c_str(), &ServerAddr.sin_addr);
|
|
||||||
if (connect(DSock, (SOCKADDR*)&ServerAddr, sizeof(ServerAddr)) != 0) {
|
|
||||||
KillSocket(DSock);
|
|
||||||
Terminate = true;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
char Code[2] = { 'D', char(ClientID) };
|
|
||||||
if (send(DSock, Code, 2, 0) != 2) {
|
|
||||||
KillSocket(DSock);
|
|
||||||
Terminate = true;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
return DSock;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::vector<char> SingleNormalDownload(SOCKET MSock, uint64_t Size, const std::string& Name) {
|
std::vector<char> SingleNormalDownload(SOCKET MSock, uint64_t Size, const std::string& Name) {
|
||||||
DownloadSpeed = 0;
|
DownloadSpeed = 0;
|
||||||
|
|
||||||
@ -561,7 +536,6 @@ void SyncResources(SOCKET Sock) {
|
|||||||
}
|
}
|
||||||
if (!FNames.empty())
|
if (!FNames.empty())
|
||||||
info("Syncing...");
|
info("Syncing...");
|
||||||
SOCKET DSock = InitDSock();
|
|
||||||
for (auto FN = FNames.begin(), FS = FSizes.begin(); FN != FNames.end() && !Terminate; ++FN, ++FS) {
|
for (auto FN = FNames.begin(), FS = FSizes.begin(); FN != FNames.end() && !Terminate; ++FN, ++FS) {
|
||||||
auto pos = FN->find_last_of('/');
|
auto pos = FN->find_last_of('/');
|
||||||
if (pos != std::string::npos) {
|
if (pos != std::string::npos) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user