Timechain
Search Donate
Sponsors
Cake Wallet, private Bitcoin and Monero walletSideShift.ai, no-signup crypto exchangeOrangeRock, non-custodial bitcoin spot and perps tradingBraiins Hashpower, buy and sell Bitcoin hashrateLayer Two Labs, drivechains for Bitcoin

linux-0.1.6-test5 fix for zombie sockets

To: Liberty Standard <newlibertystandard@gmail.com> NewLibertyStandard
test 5:

I added MSG\_DONTWAIT to the send and recv calls in case they forgot the
socket is non-blocking.  If that doesn't work, there's now the catch-all
solution: another thread monitors the send/recv thread and terminates
and restarts it if it stops.  It prints "\*\*\* Restarting
ThreadSocketHandler \*\*\*" in debug.log, and an error message displays on
the status bar for a while.

Before terminating, it tries closing the socket that's hung.  If that
works, it doesn't have to resort to terminating.

I ran a test where it terminated the thread about 1000 times without
trouble, so it should be safe.  The terminate on linux is
pthread\_cancel, which throws it into C++'s exception handler.

The thread calls we were using didn't have terminate, so I created our
own wrappers in util.h to use CreateThread on windows and pthread\_create
on linux, instead of:
\_beginthread is windows only and lacks terminate
boost::thread is really attractive, but lacks terminate
wxThread requires you to create a class for every function you might
call (yuck)

File attached in the next e-mail

All writings · Satoshi era timeline

0:000:00