mirror of
https://github.com/debauchee/barrier.git
synced 2024-12-25 12:06:26 +03:00
ed8ed72f26
init() it while it's already running. fixed an uninitialized pointer bug in CServer and some cleanup-on-error code in CMSWindowsPrimaryScreen. also added timeout to read() on IInputStream and a heartbeat sent by clients so the server can disconnect clients that are dead but never reset the TCP connection. previously the server would keep these dead clients around forever and if the user was locked on the client screen for some reason then the server would have to be rebooted (or the server would have to be killed via a remote login).
38 lines
813 B
C++
38 lines
813 B
C++
#ifndef CINPUTPACKETSTREAM_H
|
|
#define CINPUTPACKETSTREAM_H
|
|
|
|
#include "CInputStreamFilter.h"
|
|
#include "CBufferedInputStream.h"
|
|
#include "CMutex.h"
|
|
|
|
class CInputPacketStream : public CInputStreamFilter {
|
|
public:
|
|
CInputPacketStream(IInputStream*, bool adoptStream = true);
|
|
~CInputPacketStream();
|
|
|
|
// manipulators
|
|
|
|
// accessors
|
|
|
|
// IInputStream overrides
|
|
virtual void close();
|
|
virtual UInt32 read(void*, UInt32 maxCount, double timeout);
|
|
virtual UInt32 getSize() const;
|
|
|
|
private:
|
|
enum EResult { kData, kHungup, kTimedout };
|
|
|
|
UInt32 getSizeNoLock() const;
|
|
EResult waitForFullMessage(double timeout) const;
|
|
EResult getMoreMessage(double timeout) const;
|
|
bool hasFullMessage() const;
|
|
|
|
private:
|
|
CMutex m_mutex;
|
|
mutable UInt32 m_size;
|
|
mutable CBufferedInputStream m_buffer;
|
|
};
|
|
|
|
#endif
|
|
|