Facebook Story Picture Stayele

Story Article In English To Read

pin by padma krishnan on reading for sanjay english stories for kids reading comprehension worksheet the great banana reading 3rd grade 3 reading amandas news read the short story then answer grade 5 reading lesson 13 fantasy alice in wonderland 1 stories with story for grade 3 pdf 11 best stories for kids images on pinterest english reading reading reading comprehension for grade 3 your home teacher reading for fill short stories with articles a an or the englishbix short reading comprehension passages 5w s short stories made by teachers newspaper mini unit artofit pin on english stories for kids story time read and answer questions worksheet printable english sheet 6th grade reading comprehension grade1to6 com short story english stories for kids short stories for kids english download free short stories for kids part 4 pdf file 454 short 30 best short stories in english with moral valuable lessons for kids download free short stories for kids part 5 pdf file artofit short stories to read for english learners beginners infoupdate org ghim trên free teaching worksheets looking for an engaging childrens read for storytime and perhaps a nursery stories artofit english articles for reading english stories for kids learning download free short stories for reading for kids part 15 artofit very useful for reading download free short stories for reading best short story in english for grade 6 design talk grade 6 reading lesson 19 short stories the storyteller 1 reading pin by razan asfoura on articles english vocabulary words learning read the story and answer worksheet printable english sheet short stories for beginning readers fun teacher files pin by annyss houri on short article bbm reading comprehension articles to read english reading practice educational stories articles and exercises short stories for kids english created resources reading feature articles a beginner s guide westermann what is a short story in english pdf infoupdate org what is short for article at ruth hook blog fill short stories with articles a an or the englishbix short news stories twinkl resources teacher made twinkl stories in english to read moral stories grammarvocab artofit magazine article in our story magazine pdf english stories for kids english story english lessons for kids lets read short story reading comprehension for kids english poems short story for kids artofit artofit an article from the story of prince and princess with text in english 13 short story reading comprehension worksheets 10 free moral stories for kindergarten kids eduflakes teach your kids to write newspaper articles about the stories of your reading practice for kids artofit read short story for kids reading comprehension for kids english english stories for kids kids story books english story d57 artofit english reading passages about animals english reading english how to write a short story your ultimate step by step guide artofit 10 best moral short stories for kids kidstut short story for grade 3 pdf free printable templates hub short story reading reading comprehension for kids reading passages teacher fun files english stories with reading comprehension questions

:
Marketing Teaser Post Design Idea
Merge pull request Articles On Instagram from RichardStoff/master
[Fix][Crash] Serialize connection teardown with socket-queue I/O
2 parents Cute Instagram Stories + Free Printable Fonts commit 8754513

Pin by padma krishnan on reading for sanjay english stories for kids 2 files changed Read short story for kids reading comprehension for kids english

Lines changed: 107 additions & 2 deletions

Instgram Post Idea Story Article In English To Read

src/internal/sio_client_impl.cpp

Lines changed: 92 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@
2525
#define SAL_FUNC_ERROR cout<<
2626
#else
2727
#include "SAL/Log/Log.h"
28+
#include "SAL/OS/SocketQueue.h"
29+
#include "SAL/OS/Sync.h"
2830

2931
namespace {
3032
LOGGER_NAME("socketio.client")
@@ -160,17 +162,62 @@ namespace sio
160162
m_con_state = con_closing;
161163
m_abort_retries = true;
162164
this->sockets_invoke_void(&sio::socket::close);
163-
// m_client.get_io_service().dispatch(std::bind(&client_impl::close_impl, this,close::status::normal,"End by user"));
165+
#ifdef _SAL_TIME_H
166+
// The websocket transport drives I/O on the socket-queue thread, so the
167+
// close must run there too — otherwise it races with inbound frame
168+
// handling. Post() runs inline when already on that thread (the common
169+
// case here: close() is invoked from on_fail/on_open).
170+
SAL_FUNC_INFO("close(): posting close_impl to socket-queue thread");
171+
SAL::MSocketQueueManager::Post([this]() {
172+
SAL_FUNC_INFO("close(): close_impl running on socket-queue thread");
173+
this->close_impl(close::status::normal, "End by user");
174+
});
175+
#else
164176
close_impl(close::status::normal,"End by user");
177+
#endif
165178
}
166179

167180
void client_impl::sync_close()
168181
{
169182
m_con_state = con_closing;
170183
m_abort_retries = true;
171184
this->sockets_invoke_void(&sio::socket::close);
172-
// m_client.get_io_service().dispatch(std::bind(&client_impl::close_impl, this,close::status::normal,"End by user"));
185+
#ifdef _SAL_TIME_H
186+
// Called from ~client_impl: the endpoint is about to be destroyed.
187+
// Run close_impl on the socket-queue thread (serialized with inbound
188+
// frame handling) and block until it has run, so no SocketQueueKpoll
189+
// callback can touch this connection after we return. Run inline if we
190+
// are already on that thread, to avoid self-deadlock.
191+
if (SAL::MSocketQueueManager::IsOnQueueThread())
192+
{
193+
SAL_FUNC_INFO("sync_close: force-terminating inline (already on socket-queue thread)");
194+
force_close_impl();
195+
SAL_FUNC_INFO("sync_close: close completed (inline)");
196+
}
197+
else
198+
{
199+
SAL_FUNC_INFO("sync_close: dispatching force-close to socket-queue thread and waiting");
200+
SAL::Event done(false);
201+
SAL::MSocketQueueManager::Post([this, &done]() {
202+
SAL_FUNC_INFO("sync_close: force_close_impl running on socket-queue thread");
203+
this->force_close_impl();
204+
done.signal();
205+
});
206+
// Bounded wait. A live loop runs the task within its 1s heartbeat;
207+
// the timeout only guards against a wedged/dead loop so teardown
208+
// can't block forever.
209+
if (!done.wait(5000))
210+
{
211+
SAL_FUNC_ERROR("sync_close: timed out waiting for socket-queue close");
212+
}
213+
else
214+
{
215+
SAL_FUNC_INFO("sync_close: close completed on socket-queue thread");
216+
}
217+
}
218+
#else
173219
close_impl(close::status::normal,"End by user");
220+
#endif
174221
if(m_network_thread)
175222
{
176223
m_network_thread->join();
@@ -308,6 +355,43 @@ namespace sio
308355
}
309356
}
310357

358+
void client_impl::force_close_impl()
359+
{
360+
// Must run on the socket-queue thread (see sync_close). A graceful
361+
// close (close_impl → m_client.close) only sends the close
362+
// frame and waits for the peer's reply before the transport is shut
363+
// down — that shutdown (which UNREGISTERS the socket from the socket
364+
// queue) would otherwise happen AFTER ~client_impl, leaving the
365+
// websocketpp connection alive in the loop with handlers bound to a
366+
// freed client_impl → use-after-free in on_close.
367+
//
368+
// connection::terminate() forces it now: async_shutdown unregisters the
369+
// socket synchronously, then handle_terminate fires on_close — all
370+
// while client_impl is still alive. terminate() is idempotent.
371+
reset_timer(m_reconn_timer);
372+
373+
// Prefer the strong ref (survives on_close's m_con.reset()). Fall back
374+
// to the weak hdl if it is still valid.
375+
client_type::connection_ptr con = m_con_strong;
376+
if (!con && !m_con.expired())
377+
{
378+
lib::error_code ec;
379+
con = m_client.get_con_from_hdl(m_con, ec);
380+
if (ec) con.reset();
381+
}
382+
383+
if (con)
384+
{
385+
SAL_FUNC_INFO("force_close_impl: terminating connection");
386+
con->terminate(lib::error_code());
387+
}
388+
else
389+
{
390+
SAL_FUNC_INFO("force_close_impl: no active connection");
391+
}
392+
m_con_strong.reset();
393+
}
394+
311395
void client_impl::send_impl(shared_ptr<const string> const& payload_ptr,frame::opcode::value opcode)
312396
{
313397
if(m_con_state == con_opened)
@@ -447,6 +531,12 @@ namespace sio
447531
SAL_FUNC_INFO("Connected.");
448532
m_con_state = con_opened;
449533
m_con = con;
534+
{
535+
// Keep a strong ref so teardown can always reach the connection
536+
// even after on_close resets the weak m_con.
537+
lib::error_code __ec;
538+
m_con_strong = m_client.get_con_from_hdl(con, __ec);
539+
}
450540
m_reconn_made = 0;
451541
this->sockets_invoke_void(&sio::socket::on_open);
452542
this->socket("");

src/internal/sio_client_impl.h

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,13 @@ namespace sio
134134

135135
void close_impl(close::status::value const& code,std::string const& reason);
136136

137+
// Forceful, synchronous teardown of the active connection used at
138+
// destruction time. Unlike close_impl (a graceful close that defers
139+
// transport shutdown until the close handshake completes), this calls
140+
// connection::terminate() so the socket is unregistered from the socket
141+
// queue and on_close fires immediately — before the endpoint is freed.
142+
void force_close_impl();
143+
137144
void send_impl(std::shared_ptr<const std::string> const& payload_ptr,frame::opcode::value opcode);
138145

139146
void timeout_send(const std::error_code& ec);
@@ -187,6 +194,14 @@ namespace sio
187194
// Connection pointer for client functions.
188195
connection_hdl m_con;
189196
client_type m_client;
197+
// Strong reference to the active connection, captured at on_open.
198+
// m_con (a weak connection_hdl) is reset by on_close, which
199+
// runs during teardown BEFORE the forceful close — leaving us unable to
200+
// reach the still-registered connection. This strong ref survives that
201+
// reset so force_close_impl can always terminate/unregister it.
202+
// Declared after m_client so it is destroyed first (connection before
203+
// endpoint).
204+
client_type::connection_ptr m_con_strong;
190205
// Socket.IO server settings
191206
std::string m_sid;
192207
std::string m_base_url;

Interest Rates For Credit Card Companies Average Over The Years Story Article In English To Read

Comments
 (0)