Working on block receive capability.

This commit is contained in:
barant committed 2020-10-20 10:53:06 -07:00
1 parent 58dfd063f3
commit 177bc602af
2 files changed
+15 -7

No files matched your search

+13 -5
View File
@@ -1,5 +1,5 @@
#ifndef __Session_h__
#define __Session_h__
# define __Session_h__
#include "TCPSocket.h"
#include "SessionFilter.h"
@@ -7,6 +7,7 @@
namespace core {
class Command;
enum Mode {LINE, BLOCK};
class TCPServer;
@@ -59,7 +60,7 @@ namespace core {
/// Use this sendToAll method to output the contents of the out stream
/// to all the connections on the server excluding the sender session.
///
void sendToAll();
///
@@ -82,8 +83,13 @@ namespace core {
TCPServer &server;
enum Mode {LINE, BLOCK};
///
/// Set this value to control the next read event coming
/// from this socket.
///
// enum Mode {LINE, BLOCK};
protected:
///
@@ -145,14 +151,16 @@ namespace core {
/// before calling the onBlockReceived method.
///
void setMode(Mode mode, int size = 0);
void setMode(core::Mode mode, int size = 0);
private:
char *lineBuffer = NULL;
int lineBufferSize = 0;
int lineLength = 0;
int blockLength = 0;
std::mutex mtx;
bool term = false;
enum Mode mode = LINE;
core::Mode mode = LINE;
int blockSize;
};