Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 6d87851117 | |||
| 5c5f4d7d8f | |||
| ebb7628498 |
@@ -176,18 +176,6 @@ bool Utility::fmod(double dividend, double divisor)
|
||||
return std::fabs(remainder) < epsilon;
|
||||
}
|
||||
|
||||
// inline
|
||||
// size_t Utility::getAvailableDiskSpace(const String& path)
|
||||
// {
|
||||
// struct statvfs stat;
|
||||
// if (::statvfs(path, &stat) != 0)
|
||||
// {
|
||||
// throw new Exception("Error calling statvfs to get available disk space.");
|
||||
// }
|
||||
// // Calculate available space in bytes. Multiply Number of free inodes * Fragment size
|
||||
// return (size_t)stat.f_bavail * stat.f_frsize;
|
||||
// }
|
||||
|
||||
inline
|
||||
size_t Utility::getAvailableDiskSpace(const String& path)
|
||||
{
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#include <sstp/clientsocketsender.hpp>
|
||||
#include <common/utility.hpp>
|
||||
|
||||
/// @brief This is to provide a definition for SmartPointer
|
||||
ClientSocketSender::ClientSocketSender()
|
||||
@@ -69,6 +70,7 @@ bool ClientSocketSender::sendFile(String &pathFileName)
|
||||
sendPutIndicator(pathFileName, fileLength);
|
||||
Array<char> readBuffer;
|
||||
readBuffer.size(BUFFER_LENGTH);
|
||||
std::cout << "Sending file " << pathFileName << " " << Utility::byteCountToString(fileLength, false) << std::endl;
|
||||
while(true)
|
||||
{
|
||||
size_t bytesRead = readFile.read(&readBuffer[0], readBuffer.size());
|
||||
|
||||
@@ -11,10 +11,9 @@
|
||||
// To Clean: From the top menu choose "View", "Command Palette", Then choose CMake: Clean OR /usr/bin/cmake --build /home/pi/CPP/sstp/build --config Debug --target clean --
|
||||
// To Build: From the top menu choose "View", "Command Palette", Then choose CMake: Build OR /usr/bin/cmake --build /home/pi/CPP/sstp/build --config Debug --target all --
|
||||
// Output will be here. /home/pi/CPP/sstp/build
|
||||
// On Isonoe to receive we will point to the binaries here /home/pi/CPP/sstp/build
|
||||
// On Adrastea we will point to the binaries here /home/pi/Boneyard/sstp
|
||||
|
||||
|
||||
void handleServer(Block<String> &commands); // handler for server mode
|
||||
void handleClient(Block<String> &commands); // handler for client mode
|
||||
bool registerSignalHandler(void); // registers a Control-c handler
|
||||
void signalHandler(int signal); // The Control-C handler
|
||||
|
||||
@@ -28,7 +27,7 @@ int main(int argc, char **argv)
|
||||
{
|
||||
int returnCode(0);
|
||||
Profiler profiler;
|
||||
String version = "0.1.0.5"; // major version, minor version, patch, build
|
||||
String version = "1.0.0.8"; // major version, minor version, patch, build
|
||||
|
||||
std::cout << "sstp version " << version.str() << std::endl;
|
||||
if(!registerSignalHandler())
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
#include <common/utility.hpp>
|
||||
#include <common/stringbuffer.hpp>
|
||||
|
||||
|
||||
SocketConnectionReceiver::SocketConnectionReceiver()
|
||||
: mSocket(-1), mIsRunnable(true)
|
||||
{
|
||||
@@ -98,7 +97,7 @@ bool SocketConnectionReceiver::handlePut(Block<String> &commands)
|
||||
|
||||
fileName = commands[1];
|
||||
fileLength = commands[commands.size()-1].toLong();
|
||||
std::cout << "PUT" << " " << fileName << " " << Utility::byteCountToString(fileLength) << std::endl;
|
||||
std::cout << "PUT" << " " << fileName << " " << Utility::byteCountToString(fileLength,false) << std::endl;
|
||||
|
||||
availableDiskSpace=Utility::getAvailableDiskSpace(String("./"));
|
||||
std::cout << Utility::byteCountToString(availableDiskSpace,false) << " available space on disk" << std::endl;
|
||||
@@ -150,7 +149,7 @@ bool SocketConnectionReceiver::handlePut(Block<String> &commands)
|
||||
double elapsedTimeSeconds = profiler.elapsed()/1000.00;
|
||||
double bytesPerSecond = totalBytesRead / elapsedTimeSeconds;
|
||||
String strBytesPerSecond = Utility::byteCountToString(bytesPerSecond);
|
||||
std::cout << "Transferred " << Utility::byteCountToString(totalBytesRead,false) << " of " << Utility::byteCountToString(fileLength,false) << " " << percent << " percent " << strBytesPerSecond << std::endl;
|
||||
std::cout << "Received " << Utility::byteCountToString(totalBytesRead,false) << " of " << Utility::byteCountToString(fileLength,false) << " " << percent << " percent " << strBytesPerSecond << std::endl;
|
||||
}
|
||||
}
|
||||
writeFile.close();
|
||||
|
||||
@@ -53,7 +53,6 @@ SocketServer::~SocketServer()
|
||||
std::cout << "close" << std::endl;
|
||||
close(); // close the listener socket
|
||||
std::cout << "~SocketServer, done" << std::endl;
|
||||
|
||||
}
|
||||
|
||||
/// @brief Join all threads
|
||||
|
||||
Reference in New Issue
Block a user