FTPClientSession::close() error? #1880

This commit is contained in:
Alex Fabijanic
2017-10-30 11:19:54 -05:00
parent 1a18621ff8
commit 57bc179db5
3 changed files with 11 additions and 7 deletions

View File

@@ -181,20 +181,24 @@ void FTPClientSession::logout()
{ {
try { endTransfer(); } try { endTransfer(); }
catch (...) { } catch (...) { }
_isLoggedIn = false;
std::string response; std::string response;
sendCommand("QUIT", response); sendCommand("QUIT", response);
_isLoggedIn = false;
} }
} }
void FTPClientSession::close() void FTPClientSession::close()
{ {
logout(); try { logout(); }
_pControlSocket->close(); catch (...) {}
delete _pControlSocket;
_pControlSocket = 0;
_serverReady = false; _serverReady = false;
if (_pControlSocket)
{
_pControlSocket->close();
delete _pControlSocket;
_pControlSocket = 0;
}
} }

View File

@@ -212,7 +212,7 @@ int WebSocketImpl::receiveNBytes(void* buffer, int bytes)
int WebSocketImpl::receiveSomeBytes(char* buffer, int bytes) int WebSocketImpl::receiveSomeBytes(char* buffer, int bytes)
{ {
int n = _buffer.size() - _bufferOffset; int n = static_cast<int>(_buffer.size() - _bufferOffset);
if (n > 0) if (n > 0)
{ {
if (bytes < n) n = bytes; if (bytes < n) n = bytes;

View File

@@ -55,7 +55,7 @@ namespace
int n; int n;
do do
{ {
n = ws.receiveFrame(buffer.begin(), buffer.size(), flags); n = ws.receiveFrame(buffer.begin(), static_cast<int>(buffer.size()), flags);
ws.sendFrame(buffer.begin(), n, flags); ws.sendFrame(buffer.begin(), n, flags);
} }
while (n > 0 || (flags & WebSocket::FRAME_OP_BITMASK) != WebSocket::FRAME_OP_CLOSE); while (n > 0 || (flags & WebSocket::FRAME_OP_BITMASK) != WebSocket::FRAME_OP_CLOSE);