Ignore:
Timestamp:
Feb 13, 2010, 1:10:15 AM (15 years ago)
Author:
Dmitry A. Kuminov
Message:

network: Adopted to 4.6.1 changes.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/network/socket/qlocalserver_os2.cpp

    r564 r568  
    9191
    9292    // create the unix socket
    93     listenSocket = qSocket(PF_UNIX, SOCK_STREAM, 0);
     93    listenSocket = ocket(PF_UNIX, SOCK_STREAM, 0);
    9494    if (-1 == listenSocket) {
    9595        setError(QLatin1String("QLocalServer::listen"));
     
    110110
    111111    // bind
    112     if(-1 == qBind(listenSocket, (sockaddr *)&addr, sizeof(sockaddr_un))) {
     112    if(-1 == ind(listenSocket, (sockaddr *)&addr, sizeof(sockaddr_un))) {
    113113        setError(QLatin1String("QLocalServer::listen"));
    114114        // if address is in use already, just close the socket, but do not delete the file
     
    123123
    124124    // listen for connections
    125     if (-1 == qListen(listenSocket, 50)) {
     125    if (-1 == isten(listenSocket, 50)) {
    126126        setError(QLatin1String("QLocalServer::listen"));
    127127        closeServer();
     
    135135                                         QSocketNotifier::Read, q);
    136136    q->connect(socketNotifier, SIGNAL(activated(int)),
    137                q, SLOT(_q_socketActivated()));
     137               q, SLOT(_q_()));
    138138    socketNotifier->setEnabled(maxPendingConnections > 0);
    139139    return true;
     
    151151    listenSocket = -1;
    152152
    153     if (socketNotifier)
     153    if (socketNotifier) {
     154        socketNotifier->setEnabled(false); // Otherwise, closed socket is checked before deleter runs
    154155        socketNotifier->deleteLater();
    155     socketNotifier = 0;
     156        socketNotifier = 0;
     157    }
    156158
    157159    if (!fullServerName.isEmpty())
     
    165167    Accept the new socket.
    166168 */
    167 void QLocalServerPrivate::_q_socketActivated()
     169void QLocalServerPrivate::_q_()
    168170{
    169171    Q_Q(QLocalServer);
     
    172174
    173175    ::sockaddr_un addr;
    174     QT_SOCKLEN_T length = sizeof(sockaddr_un);
    175     int connectedSocket = qAccept(listenSocket, (sockaddr *)&addr, &length);
     176    length = sizeof(sockaddr_un);
     177    int connectedSocket = ccept(listenSocket, (sockaddr *)&addr, &length);
    176178    if(-1 == connectedSocket) {
    177179        setError(QLatin1String("QLocalSocket::activated"));
     
    194196    timeout.tv_usec = (msec % 1000) * 1000;
    195197
    196     // timeout can not be 0 or else select will return an error.
    197     if (0 == msec)
    198         timeout.tv_usec = 1000;
    199 
    200198    int result = -1;
    201     // on Linux timeout will be updated by select, but _not_ on other systems.
    202     QTime timer;
    203     timer.start();
    204     while (pendingConnections.isEmpty() && (-1 == msec || timer.elapsed() < msec)) {
    205         result = ::select(listenSocket + 1, &readfds, 0, 0, &timeout);
    206         if (-1 == result && errno != EINTR) {
    207             setError(QLatin1String("QLocalServer::waitForNewConnection"));
    208             closeServer();
    209             break;
    210         }
    211         if (result > 0)
    212             _q_socketActivated();
    213     }
     199    result = ::select(listenSocket + 1, &readfds, 0, 0, (msec == -1) ? 0 : &timeout);
     200    if (-1 == result) {
     201        setError(QLatin1String("QLocalServer::waitForNewConnection"));
     202        closeServer();
     203    }
     204    if (result > 0)
     205        _q_onNewConnection();
    214206    if (timedOut)
    215207        *timedOut = (result == 0);
Note: See TracChangeset for help on using the changeset viewer.