zaphoyd/websocketpp — Issue #70: Policy Refactor: There is possibility to call connection's send/ping methods without real data sending
Author: megabyte1024
Created: 2012-02-17 11:21:56+00:00
State: open

Let's suppose a thread #1 calls the connection's send method. Inside of the method the m_write_state member is set to the WRITING state. A thread #2 calls the connection's ping method between the "m_write_state = WRITING" and "m_write_state = IDLE;" lines. The result is that the thread's #2 ping call is finished without real data transmission and without ability to check it. The same situation can happen even in a single thread with two sequent calls of

connection->send(...);
connection->ping(...);

I think is possible to eliminate both the WRITING state and the m_write_buf member. The write buffer is a member is not required in this case.