Giter Site home page Giter Site logo

Comments (1)

Harinlen avatar Harinlen commented on August 21, 2024

问题已经解决。
原策略:
使用QSharedMemory作为检测机制。
如果检测到不存在命名为 org.kreogist.mu 的共享内存,那么建立一块大小为1的共享内存,然后建立一个同名的本地服务器。等待传入链接。
如果检测到之前存在一个命名为 org.kreogist.mu 的共享内存,那么直接参数发送到同名的本地服务器,然后退出。

修复后的策略:
当检测不到同名内存的时候,与之前的策略完全一致。
如果检测到之前存在一个命名为 org.kreogist.mu 的共享内存,那么直接将参数发送到同名的本地服务器。检测发送结果,如果发送成功,直接退出。(此时说明存在另一个正常运行的实例)如果发送超时,那么建立本地服务器,以此作为新的实例。(此时说明之前的实例非正常退出)

Original policy:
Use QSharedMemory as the detect policy.
If the instance can't detect the shared memory named 'org.kreogist.mu', then set up a 1-size shared memory. Then create a local server with the same name as the shared memory and wait for socket connection.
If the instance detects the shared memory, then send all parameters to the local server. Then quit.

Fixed policy:
The same as original policy when it cannot detect the shared memory.
If the instance detects the shared memory, send parameters to the local server. Check the result, if parameters are sent success, then exit. (There's a running instance) If the operation times out, then set up the local server, it could be the singleton instance. (There wass a crashed instance before, it left the shared memory.)

from mu.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.