Fle server & Query server improvements
This commit is contained in:
@@ -3471,9 +3471,23 @@ CommandResult ConnectedClient::handleCommandFTInitUpload(Command &cmd) {
|
||||
Command result(this->getExternalType() == CLIENT_TEAMSPEAK ? "notifystartupload" : "");
|
||||
result["clientftfid"] = cmd["clientftfid"].as<uint64_t>();
|
||||
result["ftkey"] = key->key;
|
||||
result["port"] = ntohs(serverInstance->getFileServer()->boundedAddress()->sin_port);
|
||||
if(serverInstance->getFileServer()->boundedAddress()->sin_addr.s_addr != 0)
|
||||
result["ip"] = inet_ntoa(serverInstance->getFileServer()->boundedAddress()->sin_addr) + string(",");
|
||||
|
||||
auto bindings = serverInstance->getFileServer()->list_bindings();
|
||||
if(!bindings.empty()) {
|
||||
result["port"] = net::port(bindings[0]->address);
|
||||
string ip = "";
|
||||
for(auto& entry : bindings) {
|
||||
if(net::is_anybind(entry->address)) {
|
||||
ip = "";
|
||||
break;
|
||||
}
|
||||
ip += net::to_string(entry->address, false) + ",";
|
||||
}
|
||||
if(!ip.empty())
|
||||
result["ip"] = ip;
|
||||
} else {
|
||||
return {findError("server_is_not_running"), "file server is not bound to any address"};
|
||||
}
|
||||
result["seekpos"] = 0;
|
||||
result["proto"] = 1;
|
||||
result["serverftfid"] = key->key_id; //TODO generate!
|
||||
@@ -3549,9 +3563,24 @@ CommandResult ConnectedClient::handleCommandFTInitDownload(Command &cmd) {
|
||||
result["proto"] = 1;
|
||||
result["serverftfid"] = key->key_id;
|
||||
result["ftkey"] = key->key;
|
||||
result["port"] = ntohs(serverInstance->getFileServer()->boundedAddress()->sin_port);
|
||||
if(serverInstance->getFileServer()->boundedAddress()->sin_addr.s_addr != 0)
|
||||
result["ip"] = inet_ntoa(serverInstance->getFileServer()->boundedAddress()->sin_addr) + string(",");
|
||||
|
||||
auto bindings = serverInstance->getFileServer()->list_bindings();
|
||||
if(!bindings.empty()) {
|
||||
result["port"] = net::port(bindings[0]->address);
|
||||
string ip = "";
|
||||
for(auto& entry : bindings) {
|
||||
if(net::is_anybind(entry->address)) {
|
||||
ip = "";
|
||||
break;
|
||||
}
|
||||
ip += net::to_string(entry->address, false) + ",";
|
||||
}
|
||||
if(!ip.empty())
|
||||
result["ip"] = ip;
|
||||
} else {
|
||||
return {findError("server_is_not_running"), "file server is not bound to any address"};
|
||||
}
|
||||
|
||||
result["size"] = key->size;
|
||||
this->sendCommand(result);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user