Permalink
Browse files

sconex/Stream: Remove has_writeable as it makes no sense

  • Loading branch information...
sconemad committed Jun 7, 2017
1 parent ccc1efd commit dee8fee8993cfd267f44dbd6fbdaa0e3791cc027
Showing with 4 additions and 30 deletions.
  1. +1 −7 http/WebSocket.cpp
  2. +0 −1 http/WebSocket.h
  3. +0 −4 sconex/Descriptor.cpp
  4. +1 −8 sconex/Stream.cpp
  5. +2 −3 sconex/Stream.h
  6. +0 −6 sconex/StreamBuffer.cpp
  7. +0 −1 sconex/StreamBuffer.h
@@ -214,13 +214,7 @@ scx::Condition WebSocketStream::event(scx::Stream::Event e)
bool WebSocketStream::has_readable() const
{
return (m_read_state == Data &&
m_read_buffer.used() > 0);
}

//=============================================================================
bool WebSocketStream::has_writeable() const
{
return (m_write_buffer.used() > 0);
m_read_buffer.used());
}

//=============================================================================
@@ -60,7 +60,6 @@ class HTTP_API WebSocketStream : public scx::Stream {
virtual scx::Condition write(const void* buffer,int n,int& na);
virtual scx::Condition event(scx::Stream::Event e);
virtual bool has_readable() const;
virtual bool has_writeable() const;
virtual std::string stream_status() const;

private:
@@ -475,10 +475,6 @@ int Descriptor::dispatch(int events)
stream->has_readable()) {
event_readable = true;
}
if (!event_writeable &&
stream->has_writeable()) {
event_writeable = true;
}
++it;
}

@@ -150,12 +150,6 @@ bool Stream::has_readable() const
return false;
}

//=============================================================================
bool Stream::has_writeable() const
{
return false;
}

//=============================================================================
void Stream::set_endpoint(Descriptor* endpoint)
{
@@ -183,13 +177,12 @@ std::string Stream::stream_status() const
//=============================================================================
std::string Stream::event_status() const
{
std::string es = "------";
std::string es = "-----";
if (m_events & (1<<Opening)) es[0]='o';
if (m_events & (1<<Closing)) es[1]='c';
if (m_events & (1<<Readable)) es[2]='r';
if (m_events & (1<<Writeable)) es[3]='w';
if (has_readable()) es[4]='R';
if (has_writeable()) es[5]='W';
return es;
}

@@ -109,10 +109,9 @@ class SCONEX_API Stream : public IOBase {
//
virtual Condition event(Event e);

// Does this stream have any buffered data to be read/written?
// Does this stream have any buffered data to be read?
virtual bool has_readable() const;
virtual bool has_writeable() const;


// Get/set chain pointer
void set_endpoint(Descriptor* endpoint);
void set_chain(Stream* chain);
@@ -191,12 +191,6 @@ bool StreamBuffer::has_readable() const
return (m_read_buffer.used() > 0);
}

//=============================================================================
bool StreamBuffer::has_writeable() const
{
return (m_write_buffer.used() > 0);
}

//=============================================================================
Condition StreamBuffer::write_through(
const void* buffer,
@@ -63,7 +63,6 @@ class SCONEX_API StreamBuffer : public Stream {

virtual Condition event(Event e);
virtual bool has_readable() const;
virtual bool has_writeable() const;

virtual std::string stream_status() const;

0 comments on commit dee8fee

Please sign in to comment.