NetworkStream: Add setBlocking() and getNativeHandle(). (#161)

Also add checking for "would block" errors in send() and receive().

Check for set nonblocking failures in TCPConnector as well (generate warnings rather than errors)
This commit is contained in:
Peter Johnson
2016-11-27 19:59:52 -08:00
committed by GitHub
parent 00b76d42e0
commit 558b2ffa41
4 changed files with 74 additions and 10 deletions

View File

@@ -43,6 +43,7 @@ class TCPStream : public NetworkStream {
int m_sd;
std::string m_peerIP;
int m_peerPort;
bool m_blocking;
public:
friend class TCPAcceptor;
@@ -58,6 +59,8 @@ class TCPStream : public NetworkStream {
llvm::StringRef getPeerIP() const override;
int getPeerPort() const override;
void setNoDelay() override;
bool setBlocking(bool enabled) override;
int getNativeHandle() const override;
TCPStream(const TCPStream& stream) = delete;
TCPStream& operator=(const TCPStream&) = delete;