m_inputStream = g_io_stream_get_input_stream(G_IO_STREAM(m_socketConnection.get()));
m_readBuffer = new char[READ_BUFFER_SIZE];
+#if ENABLE(TIZEN_WEBSOCKET_ADD_CANCELLABLE)
+ m_cancellable = g_cancellable_new();
+ g_input_stream_read_async(m_inputStream.get(), m_readBuffer, READ_BUFFER_SIZE, G_PRIORITY_DEFAULT, m_cancellable.get(),
+ reinterpret_cast<GAsyncReadyCallback>(readReadyCallback), m_id);
+#else
g_input_stream_read_async(m_inputStream.get(), m_readBuffer, READ_BUFFER_SIZE, G_PRIORITY_DEFAULT, 0,
reinterpret_cast<GAsyncReadyCallback>(readReadyCallback), m_id);
+#endif
m_state = Open;
m_client->didOpenSocketStream(this);
RefPtr<SocketStreamHandle> protect(this);
m_client->didReceiveSocketStreamData(this, m_readBuffer, bytesRead);
if (m_inputStream) // The client may have closed the connection.
+#if ENABLE(TIZEN_WEBSOCKET_ADD_CANCELLABLE)
+ g_input_stream_read_async(m_inputStream.get(), m_readBuffer, READ_BUFFER_SIZE, G_PRIORITY_DEFAULT, m_cancellable.get(),
+ reinterpret_cast<GAsyncReadyCallback>(readReadyCallback), m_id);
+#else
g_input_stream_read_async(m_inputStream.get(), m_readBuffer, READ_BUFFER_SIZE, G_PRIORITY_DEFAULT, 0,
reinterpret_cast<GAsyncReadyCallback>(readReadyCallback), m_id);
+#endif
}
void SocketStreamHandle::writeReady()
stopWaitingForSocketWritability();
if (m_socketConnection) {
+#if ENABLE(TIZEN_WEBSOCKET_ADD_CANCELLABLE)
+ g_cancellable_cancel(m_cancellable.get());
+#endif
GOwnPtr<GError> error;
g_io_stream_close(G_IO_STREAM(m_socketConnection.get()), 0, &error.outPtr());
if (error)
m_outputStream = 0;
m_inputStream = 0;
delete m_readBuffer;
+#if ENABLE(TIZEN_WEBSOCKET_ADD_CANCELLABLE)
+ m_cancellable = 0;
+#endif
m_client->didCloseSocketStream(this);
}