Code Monkey home page Code Monkey logo

unixdomainsocket's People

Contributors

leopard-c avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

jeasonb

unixdomainsocket's Issues

uds 服务端第一次发送数据存在概率 发送到错误的位置

void ImplBaseServer::Start() 内部的 struct sockaddr_un client_addr; 变量未进行初始化,存在一定的几率 导致 回调函数的client_addr 参数内部的 sun_path 包含乱码。进而导致服务端的调用的应答信息丢失。
我这边临时的解决方案如下: (每个循环都会清除这个结构体)
`void ImplBaseServer::Start() {
if (!inited_ || !stopped_) {
return;
}
should_stop_ = false;
stopped_ = false;

struct sockaddr_un client_addr;
socklen_t client_addr_length = sizeof(client_addr);
fd_set read_fds;
Packet* packet = nullptr;

while (!should_stop_) {
    if (!packet) {
        packet = new Packet();
    }
    memset(&client_addr, 0, sizeof(client_addr));
    if (util::recv_data(fd_, &read_fds, packet, &client_addr, &client_addr_length)) {
        ProcessRequestPacket(client_addr, packet);
    }
}
if (packet) {
    delete packet;
    packet = nullptr;
}

stopped_ = true;

}`

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.