refactoring + cancellation was buggy during http upgrade

This commit is contained in:
Benjamin Sergeant
2019-01-02 07:45:07 -08:00
parent b95e5e36dc
commit 2b136b2981
4 changed files with 88 additions and 79 deletions

View File

@ -14,8 +14,6 @@
#include "IXEventFd.h"
#include "IXCancellationRequest.h"
struct addrinfo;
namespace ix
{
class Socket {
@ -41,6 +39,13 @@ namespace ix
virtual int send(const std::string& buffer);
virtual int recv(void* buffer, size_t length);
// Blocking and cancellable versions, working with socket that can be set
// to non blocking mode. Used during HTTP upgrade.
bool readByte(void* buffer,
const CancellationRequest& isCancellationRequested);
bool writeBytes(const std::string& str,
const CancellationRequest& isCancellationRequested);
int getErrno() const;
static bool init(); // Required on Windows to initialize WinSocket
static void cleanup(); // Required on Windows to cleanup WinSocket