Skip to content

回复:Linux 构建 ​

首次公开证据

打开首次公开证据
查看 1 个交叉存档
来源说明

Published on GitHub in February 2024 as part of Martti Malmi's testimony in the COPA v. Wright trial

它现在已经能在 Linux 上可靠运行了,但如果它在 GUI 线程之外使用 wxMessageBox(),就会崩溃,因为非 GUI 线程不能在 Linux 上打开窗口。我还没顾上修复这个问题。我一直在对它运行压力测试,它的运行一切正常。

wxWidgets 的大部分功能用在 UI 线程以外的线程中都不是线程安全的,但根据经验,在 Windows 上,任何与 UI 无关的功能都没问题。结果发现它在 GTK 上更不具备线程安全性。我一次替换了许多东西,所以不知道是否只是其中某一个东西造成的(很可能是 Repaint),但我不得不假定,甚至任何使用 wxString 的 wx 函数在 UI 线程之外使用都不安全。真要命,这下所有好用的 wxWidgets 可移植性支持函数都没法用了。我保留了少数简单的东西,比如 wxThread::GetCPUCount(),我检查过它的源代码,全都是数值操作;而 wxMutex 必须是安全的,否则它就毫无用处。

有一个问题:如果你退出后立刻再次运行它,它就无法绑定端口 8333。端口会在大约一分钟后释放。除非我漏掉了什么,否则我确实在退出前关闭了套接字,所以我不知道还能做什么。也许这只是 Linux 的某种特性:释放一个曾绑定过的端口需要一分钟。这也可能是一项安全功能,以免某个木马终止 Web 服务器后迅速取而代之,接收客户端的所有重试请求。

还得弄清楚如何正确制作 xpm 版本的图标。

我想知道数据库的 dat 文件能否与 Windows 互换使用。

英文原文 ​

展开英文原文

It works reliably on Linux now, except if it uses wxMessageBox() outside the GUI thread, it'll crash because non-GUI threads can't open a window on Linux. I haven't got to fixing that yet. I've been running my stress test on it and it's functioning normally.

Most of wxWidgets is not thread-safe to use in threads other than the UI thread, but as a rule of thumb on Windows anything not UI related is OK. It turns out its more thread-unsafe on GTK. I replaced a bunch of stuff at once so I don't know if it was just one thing (probably Repaint), but I have to assume even any wx function that uses wxString is not safe to use outside the UI thread. So dang, there goes all the nice wxWidgets portability support functions. I left a few simple things like wxThread::GetCPUCount() that I checked the source and it's all numerical, and wxMutex has to be safe or it'd be useless.

There's an issue that if you exit and run it again right away, it can't bind port 8333. The port frees up after about a minute. Unless I'm missing something, I am closing the socket before exit, so I don't know what else I can do. Maybe this is just something about Linux that it takes a minute to free up a port you had bound. Possibly a security feature so some trojan doesn't kill the web server and quickly jump into its place and pick up all the client retries.

Still gotta figure out how to do the xpm version of the icon correctly.

I wonder if the database dat files are interchangeable with Windows.

为历史保存,为中文读者整理。每篇档案均附来源与英文原文。