Browse Source

Squished some bugs.

Reduced default Socket buffer size from 4096 to 512.
release/0.19
Jessica James 9 years ago
parent
commit
de16603f51
  1. 8
      Jupiter/HTTP_Server.cpp
  2. 2
      Jupiter/Readable_String.h
  3. 4
      Jupiter/SecureSocket.h
  4. 4
      Jupiter/Socket.cpp
  5. 4
      Jupiter/Socket.h
  6. BIN
      Release/Jupiter.lib

8
Jupiter/HTTP_Server.cpp

@ -144,6 +144,7 @@ bool Jupiter::HTTP::Server::Directory::remove(const Jupiter::ReadableString &pat
if (in_name_ref.isEmpty()) // Remove content
{
Jupiter::HTTP::Server::Content *content_node;
checksum = content_name.calcChecksum();
index = Jupiter::HTTP::Server::Directory::content.size();
while (index != 0)
{
@ -797,7 +798,8 @@ int Jupiter::HTTP::Server::think()
}
else if ((std::chrono::steady_clock::now() > session->last_active + Jupiter::HTTP::Server::data_->keep_alive_session_timeout)
|| (session->keep_alive == false && std::chrono::steady_clock::now() > session->last_active + Jupiter::HTTP::Server::data_->session_timeout))
session->sock.shutdown();
delete Jupiter::HTTP::Server::data_->sessions.remove(index);
//session->sock.shutdown();
else if (session->sock.recv() > 0)
{
const Jupiter::ReadableString &sock_buffer = session->sock.getBuffer();
@ -809,7 +811,8 @@ int Jupiter::HTTP::Server::think()
session->last_active = std::chrono::steady_clock::now();
Jupiter::HTTP::Server::data_->process_request(*session);
if (session->keep_alive == false) // remove completed session
session->sock.shutdown();
delete Jupiter::HTTP::Server::data_->sessions.remove(index);
//session->sock.shutdown();
}
else if (session->request.size() == Jupiter::HTTP::Server::data_->max_request_size) // reject (full buffer)
delete Jupiter::HTTP::Server::data_->sessions.remove(index);
@ -831,6 +834,7 @@ int Jupiter::HTTP::Server::think()
{
socket->setBlocking(false);
session = new HTTPSession(std::move(*socket));
printf("Incoming session; %u other sessions already stored." ENDL, this->data_->sessions.size());
if (session->sock.recv() > 0) // data received
{
const Jupiter::ReadableString &sock_buffer = session->sock.getBuffer();

2
Jupiter/Readable_String.h

@ -1,5 +1,5 @@
/**
* Copyright (C) 2014-2015 Jessica James.
* Copyright (C) 2014-2016 Jessica James.
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above

4
Jupiter/SecureSocket.h

@ -1,5 +1,5 @@
/**
* Copyright (C) 2013-2015 Jessica James.
* Copyright (C) 2013-2016 Jessica James.
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
@ -168,7 +168,7 @@ namespace Jupiter
/**
* @brief Default constructor for the SecureSocket class.
* This constructor will set the buffer size to 4096 chars.
* This constructor will set the buffer size to 512 chars.
*/
SecureSocket();

4
Jupiter/Socket.cpp

@ -96,7 +96,7 @@ Jupiter::Socket &Jupiter::Socket::operator=(Jupiter::Socket &&source)
return *this;
}
Jupiter::Socket::Socket() : Jupiter::Socket::Socket(4096)
Jupiter::Socket::Socket() : Jupiter::Socket::Socket(512)
{
}
@ -116,9 +116,7 @@ Jupiter::Socket::~Socket()
if (Jupiter::Socket::data_ != nullptr)
{
if (Jupiter::Socket::data_->rawSock > 0)
{
Jupiter::Socket::close();
}
delete Jupiter::Socket::data_;
}
}

4
Jupiter/Socket.h

@ -1,5 +1,5 @@
/**
* Copyright (C) 2013-2015 Jessica James.
* Copyright (C) 2013-2016 Jessica James.
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
@ -492,7 +492,7 @@ namespace Jupiter
/**
* @brief Default constructor for the Socket class.
* This constructor will set the buffer size to 4096 chars.
* This constructor will set the buffer size to 512 chars.
*/
Socket();

BIN
Release/Jupiter.lib

Binary file not shown.
Loading…
Cancel
Save