[installation] Change to nightly
This commit is contained in:
@ -44,30 +44,42 @@ class SC_SYSTEM_CORE_API ClientSession : public Session {
|
||||
ClientSession(Device *dev, size_t maxCharactersPerLine = 200);
|
||||
|
||||
public:
|
||||
//! Flush data still in the buffer.
|
||||
virtual void flush();
|
||||
|
||||
//! Update the session state including flushing and
|
||||
//! reading available data.
|
||||
void update() override;
|
||||
|
||||
//! Queue data in the outbox
|
||||
void send(const char *data, size_t len);
|
||||
void send(const char *data);
|
||||
//! Sets keepReading to false
|
||||
void close() override;
|
||||
|
||||
//! Queues a buffer and returns whether the queue was empty
|
||||
bool send(Buffer *);
|
||||
|
||||
//! Sets keepReading to false
|
||||
void close() override;
|
||||
/**
|
||||
* @brief Sends a null-terminated character string.
|
||||
* If not all data could be sent then a buffer with remaining
|
||||
* data will be created and queued.
|
||||
* @param data The null-terminated string
|
||||
*/
|
||||
void send(const char *data);
|
||||
|
||||
/**
|
||||
* @brief Sends a memory block of bytes.
|
||||
* This function is faster than send(const char*) as it does not
|
||||
* need to run strlen().
|
||||
* @param data The byte array
|
||||
* @param size The number of bytes
|
||||
*/
|
||||
void send(const char *data, size_t size);
|
||||
|
||||
//! Returns the number of bytes currently in the output buffer
|
||||
//! which haven't been sent yet.
|
||||
size_t outputBufferSize() const;
|
||||
|
||||
bool valid() const;
|
||||
bool erroneous() const;
|
||||
|
||||
|
||||
protected:
|
||||
virtual void outboxFlushed();
|
||||
|
||||
virtual void buffersFlushed();
|
||||
virtual void bufferSent(Buffer*);
|
||||
|
||||
@ -78,9 +90,6 @@ class SC_SYSTEM_CORE_API ClientSession : public Session {
|
||||
|
||||
void setMIMEUnfoldingEnabled(bool);
|
||||
|
||||
//! Returns the available bytes to send.
|
||||
virtual size_t inAvail() const;
|
||||
|
||||
void setError(const char* msg);
|
||||
|
||||
//! Sets the error state
|
||||
@ -105,7 +114,14 @@ class SC_SYSTEM_CORE_API ClientSession : public Session {
|
||||
|
||||
|
||||
private:
|
||||
void flushOutbox();
|
||||
/**
|
||||
* @brief Queues a buffer without the attempt to send it.
|
||||
* @return True, if the queue was empty, false otherwise.
|
||||
*/
|
||||
bool queue(Buffer *);
|
||||
|
||||
//! Flush data still in the buffer.
|
||||
void flush(bool flagFlush = false);
|
||||
|
||||
|
||||
protected:
|
||||
@ -117,17 +133,16 @@ class SC_SYSTEM_CORE_API ClientSession : public Session {
|
||||
//Future2 = 0x0008,
|
||||
//Future3 = 0x0010,
|
||||
//Future4 = 0x0020,
|
||||
//Future5 = 0x0040,
|
||||
//Future6 = 0x0080,
|
||||
PendingFlush = 0x0040,
|
||||
AppendBuffer = 0x0080,
|
||||
Erroneous = 0x0100
|
||||
};
|
||||
|
||||
std::vector<char> _inbox;
|
||||
size_t _inboxPos;
|
||||
std::vector<char> _outbox;
|
||||
uint16_t _flags;
|
||||
size_t _postDataSize;
|
||||
Device::count_t _bytesSent;
|
||||
size_t _inboxPos{0};
|
||||
uint16_t _flags{NoFlags};
|
||||
size_t _postDataSize{0};
|
||||
Device::count_t _bytesSent{0};
|
||||
|
||||
|
||||
private:
|
||||
@ -135,10 +150,14 @@ class SC_SYSTEM_CORE_API ClientSession : public Session {
|
||||
size_t _currentBufferHeaderOffset;
|
||||
size_t _currentBufferDataOffset;
|
||||
BufferList _bufferQueue;
|
||||
size_t _bufferBytesPending;
|
||||
size_t _bufferBytesPending{0};
|
||||
};
|
||||
|
||||
|
||||
inline size_t ClientSession::outputBufferSize() const {
|
||||
return _bufferBytesPending;
|
||||
}
|
||||
|
||||
inline bool ClientSession::valid() const {
|
||||
return !erroneous();
|
||||
}
|
||||
|
||||
@ -23,10 +23,11 @@
|
||||
|
||||
#include <seiscomp/wired/device.h>
|
||||
|
||||
#include <stdint.h>
|
||||
#include <cstdint>
|
||||
#include <ostream>
|
||||
|
||||
#include <openssl/ssl.h>
|
||||
#include <openssl/pkcs12.h>
|
||||
#include <ostream>
|
||||
|
||||
|
||||
namespace Seiscomp {
|
||||
@ -125,7 +126,7 @@ class SC_SYSTEM_CORE_API Socket : public Device {
|
||||
dwords[1] = dwords[2] = dwords[3] = 0;
|
||||
}
|
||||
|
||||
bool fromString(const char *);
|
||||
bool fromString(const char *str);
|
||||
bool fromStringV4(const char *);
|
||||
bool fromStringV6(const char *);
|
||||
|
||||
|
||||
@ -185,7 +185,7 @@ struct HttpRequest {
|
||||
std::string secWebsocketProtocol;
|
||||
std::string secWebsocketKey;
|
||||
int secWebsocketVersion;
|
||||
Time ifModifiedSince;
|
||||
OPT(Time) ifModifiedSince;
|
||||
bool keepAlive;
|
||||
bool addKeepAliveHeader;
|
||||
bool upgrade;
|
||||
@ -236,7 +236,7 @@ struct URLOptions {
|
||||
|
||||
|
||||
struct URLInsituOptions {
|
||||
URLInsituOptions(std::string &s) : _source(&s[0]), _source_len(s.size()) {}
|
||||
URLInsituOptions(std::string &s) : _source(s.data()), _source_len(s.size()) {}
|
||||
|
||||
URLInsituOptions(char *src, size_t l) : _source(src), _source_len(l) {}
|
||||
|
||||
@ -408,7 +408,7 @@ class SC_SYSTEM_CORE_API HttpSession : public ClientSession {
|
||||
void handleInbox(const char *data, size_t len) override;
|
||||
void handleInboxError(Error error) override;
|
||||
void handlePostData(const char *data, size_t len) override;
|
||||
void outboxFlushed() override;
|
||||
void buffersFlushed() override;
|
||||
|
||||
virtual bool validatePostDataSize(size_t postDataSize);
|
||||
virtual void requestFinished();
|
||||
@ -431,7 +431,7 @@ class SC_SYSTEM_CORE_API HttpSession : public ClientSession {
|
||||
|
||||
|
||||
inline URLPath::URLPath(const std::string &s)
|
||||
: _source(&s[0])
|
||||
: _source(s.data())
|
||||
, _source_len(s.size())
|
||||
{
|
||||
while ( _source_len && (*_source == '/') ) {
|
||||
@ -483,7 +483,7 @@ inline size_t URLPath::remainderLength() const {
|
||||
}
|
||||
|
||||
inline URLInsituPath::URLInsituPath(std::string &s)
|
||||
: part_start(&s[0])
|
||||
: part_start(s.data())
|
||||
, part_len(0)
|
||||
, _source(part_start)
|
||||
, _source_len(s.size())
|
||||
|
||||
@ -136,6 +136,24 @@ class SC_SYSTEM_CORE_API Reactor : public Seiscomp::Core::BaseObject {
|
||||
bool setTriggerMode(TriggerMode);
|
||||
TriggerMode triggerMode() const;
|
||||
|
||||
/**
|
||||
* @brief Sets the number of bytes a session can read in one
|
||||
* turn without passing operation to other sessions.
|
||||
* The default value of 4096 limit has been chosen to not let clients
|
||||
* starve when many connections are active.
|
||||
* @param limit The number of limit allowed. Default is 4096.
|
||||
*/
|
||||
void setReadQuota(size_t limit);
|
||||
|
||||
/**
|
||||
* @brief Sets the number of bytes a session can write in one
|
||||
* turn without passing operation to other sessions.
|
||||
* The default value of 4096 limit has been chosen to not let clients
|
||||
* starve when many connections are active.
|
||||
* @param limit The number of limit allowed. Default is 4096.
|
||||
*/
|
||||
void setWriteQuota(size_t limit);
|
||||
|
||||
const SessionList &sessions() const;
|
||||
|
||||
const DeviceGroup *devices() const;
|
||||
@ -144,9 +162,9 @@ class SC_SYSTEM_CORE_API Reactor : public Seiscomp::Core::BaseObject {
|
||||
* @brief getBuffer returns a temporary buffer that sessions can use
|
||||
* to read from device.
|
||||
* @param buf Address that is populated with the buffer address
|
||||
* @param len Length will hold the length of the buffer
|
||||
* @return The buffer size
|
||||
*/
|
||||
void getBuffer(char *&buf, size_t &len);
|
||||
size_t getBuffer(char *&buf);
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
@ -167,6 +185,9 @@ class SC_SYSTEM_CORE_API Reactor : public Seiscomp::Core::BaseObject {
|
||||
std::vector<char> _buffer;
|
||||
bool _shouldRun;
|
||||
bool _isRunning;
|
||||
size_t _sessionBytesAllocated;
|
||||
size_t _readQuota{4096};
|
||||
size_t _writeQuota{4096};
|
||||
SessionList _sessions;
|
||||
SessionList _deferredSession;
|
||||
DeviceGroup _devices;
|
||||
|
||||
@ -30,6 +30,22 @@ namespace Seiscomp {
|
||||
namespace Wired {
|
||||
|
||||
|
||||
struct BindAddress {
|
||||
BindAddress() = default;
|
||||
BindAddress(const Seiscomp::Wired::Socket::IPAddress &addr, int port)
|
||||
: address(addr), port(port) {}
|
||||
|
||||
bool valid() const { return port > 0; }
|
||||
|
||||
Seiscomp::Wired::Socket::IPAddress address;
|
||||
int port{-1};
|
||||
};
|
||||
|
||||
|
||||
std::string toString(const BindAddress &bind);
|
||||
bool fromString(BindAddress &bind, std::string_view sv);
|
||||
|
||||
|
||||
DEFINE_SMARTPOINTER(Server);
|
||||
|
||||
class SC_SYSTEM_CORE_API Server : public Reactor {
|
||||
|
||||
@ -86,15 +86,16 @@ class SC_SYSTEM_CORE_API Session : public Core::BaseObject,
|
||||
// Protected members
|
||||
// ----------------------------------------------------------------------
|
||||
protected:
|
||||
DevicePtr _device;
|
||||
Reactor *_parent;
|
||||
DevicePtr _device;
|
||||
Reactor *_parent;
|
||||
size_t _writeQuota{0};
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
// Private members
|
||||
// ----------------------------------------------------------------------
|
||||
private:
|
||||
bool _tagged;
|
||||
bool _tagged;
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user