lucusfly / network

tcp select epoll filetranslation
5 stars 2 forks source link

Should accept need exception handle? #2

Open stallion5632 opened 9 years ago

stallion5632 commented 9 years ago
        int clifd = accept(listenfd, (sockaddr*)&cliAddr, &len);
        if (clifd < 0) 
        {
            if (errno == EINTR)
            {
                continue;
            }
            else
            {
                cout << "accept error:" << strerror(errno) << endl;
                                     exit(1);
            }                               
        }
stallion5632 commented 9 years ago

I think above is the correct way。

lucusfly commented 9 years ago

which file?

stallion5632 commented 9 years ago

I'm sorry, I didn't say complete. It is in network/select/server.cpp Line24

lucusfly commented 9 years ago

Yes, you're right. Except that we shouldn't let server exit after a client accept error.