<feed xmlns='http://www.w3.org/2005/Atom'>
<title>cimple/src/tcp_server.h, branch meson</title>
<subtitle>My little CI system (hopefully)</subtitle>
<id>http://git.tensin.name/cimple/atom?h=meson</id>
<link rel='self' href='http://git.tensin.name/cimple/atom?h=meson'/>
<link rel='alternate' type='text/html' href='http://git.tensin.name/cimple/'/>
<updated>2026-09-21T17:19:05Z</updated>
<entry>
<title>remove annoying trailing period from repo URLs</title>
<updated>2026-09-21T17:19:05Z</updated>
<author>
<name>Egor Tensin</name>
<email>egor@tensin.name</email>
</author>
<published>2026-09-21T17:19:05Z</published>
<link rel='alternate' type='text/html' href='http://git.tensin.name/cimple/commit/?id=588fd2262c2f65e237a5a4e4858e06b4b87aaae3'/>
<id>urn:sha1:588fd2262c2f65e237a5a4e4858e06b4b87aaae3</id>
<content type='text'>
</content>
</entry>
<entry>
<title>finally, perfect .clang-format settings?</title>
<updated>2026-06-13T18:16:43Z</updated>
<author>
<name>Egor Tensin</name>
<email>egor@tensin.name</email>
</author>
<published>2026-06-13T18:16:43Z</published>
<link rel='alternate' type='text/html' href='http://git.tensin.name/cimple/commit/?id=d64e7bf3d93649b78231912f37606153e3d30665'/>
<id>urn:sha1:d64e7bf3d93649b78231912f37606153e3d30665</id>
<content type='text'>
</content>
</entry>
<entry>
<title>unify my .clang-format files</title>
<updated>2026-06-12T15:20:08Z</updated>
<author>
<name>Egor Tensin</name>
<email>egor@tensin.name</email>
</author>
<published>2026-06-12T15:20:08Z</published>
<link rel='alternate' type='text/html' href='http://git.tensin.name/cimple/commit/?id=1160cdb21e0b667269299853cb47a4aa88948dc3'/>
<id>urn:sha1:1160cdb21e0b667269299853cb47a4aa88948dc3</id>
<content type='text'>
</content>
</entry>
<entry>
<title>switch to egor@tensin.name</title>
<updated>2023-12-12T20:29:42Z</updated>
<author>
<name>Egor Tensin</name>
<email>egor@tensin.name</email>
</author>
<published>2023-12-12T20:29:42Z</published>
<link rel='alternate' type='text/html' href='http://git.tensin.name/cimple/commit/?id=82c5f204346def706fdc7ee28a8e2570fb880369'/>
<id>urn:sha1:82c5f204346def706fdc7ee28a8e2570fb880369</id>
<content type='text'>
</content>
</entry>
<entry>
<title>tcp_server: keep track of client threads</title>
<updated>2023-07-05T14:18:05Z</updated>
<author>
<name>Egor Tensin</name>
<email>Egor.Tensin@gmail.com</email>
</author>
<published>2023-07-05T13:30:57Z</published>
<link rel='alternate' type='text/html' href='http://git.tensin.name/cimple/commit/?id=8465f8181eda45e3d6cc5d6c3d08ca36db04763b'/>
<id>urn:sha1:8465f8181eda45e3d6cc5d6c3d08ca36db04763b</id>
<content type='text'>
This is a major change, obviously; brought to me by Valgrind, which
noticed that we don't actually clean up after cimple-client threads.
For a more thorough explanation, please see the added comment in
tcp_server.c.
</content>
</entry>
<entry>
<title>use signalfd to stop on SIGTERM</title>
<updated>2023-06-12T23:37:08Z</updated>
<author>
<name>Egor Tensin</name>
<email>Egor.Tensin@gmail.com</email>
</author>
<published>2023-06-11T23:42:08Z</published>
<link rel='alternate' type='text/html' href='http://git.tensin.name/cimple/commit/?id=48ce9170b057ddd2165b0239a92aede15849f7a3'/>
<id>urn:sha1:48ce9170b057ddd2165b0239a92aede15849f7a3</id>
<content type='text'>
Is this an overkill? I don't know.

The thing is, correctly intercepting SIGTERM (also SIGINT, etc.) is
incredibly tricky. For example, before this commit, my I/O loops in
server.c and worker.c were inherently racy.

This was immediately obvious if you tried to run the tests. The tests
(especially the Valgrind flavour) would run a worker, wait until it
prints a "Waiting for a new command" line, and try to kill it using
SIGTERM. The problem is, the global_stop_flag check could have already
been executed by the worker, and it would hang forever in recv().

The solution seems to be to use signalfd and select()/poll(). I've never
used either before, but it seems to work well enough - at least the very
same tests pass and don't hang now.
</content>
</entry>
<entry>
<title>make struct tcp_server opaque</title>
<updated>2023-04-29T07:57:16Z</updated>
<author>
<name>Egor Tensin</name>
<email>Egor.Tensin@gmail.com</email>
</author>
<published>2023-04-28T10:58:42Z</published>
<link rel='alternate' type='text/html' href='http://git.tensin.name/cimple/commit/?id=37895358b03b805f1887749c8dc73d1e075af810'/>
<id>urn:sha1:37895358b03b805f1887749c8dc73d1e075af810</id>
<content type='text'>
</content>
</entry>
<entry>
<title>add copyright notices</title>
<updated>2022-12-02T15:00:29Z</updated>
<author>
<name>Egor Tensin</name>
<email>Egor.Tensin@gmail.com</email>
</author>
<published>2022-12-02T15:00:29Z</published>
<link rel='alternate' type='text/html' href='http://git.tensin.name/cimple/commit/?id=9a0bca49f80f841f0689712b9bc8f5f69ad2b3e5'/>
<id>urn:sha1:9a0bca49f80f841f0689712b9bc8f5f69ad2b3e5</id>
<content type='text'>
</content>
</entry>
<entry>
<title>net: rework API</title>
<updated>2022-08-25T08:56:03Z</updated>
<author>
<name>Egor Tensin</name>
<email>Egor.Tensin@gmail.com</email>
</author>
<published>2022-08-25T08:47:06Z</published>
<link rel='alternate' type='text/html' href='http://git.tensin.name/cimple/commit/?id=08ee3cab641f367b642bc29f6540de6be85226bd'/>
<id>urn:sha1:08ee3cab641f367b642bc29f6540de6be85226bd</id>
<content type='text'>
First, rename all API functions so that they start with net_.

Second, abstract the basic TCP server functionality into tcp_server.c.
This includes reworking net_accept so that it's a simple blocking
operation, and putting the callback stuff to tcp_server.c. Also, the
server now uses detached threads instead of fork(), since I want
connection handlers to share memory.
</content>
</entry>
</feed>
