src/network/socket/qlocalsocket_tcp.cpp
changeset 7 f7bc934e204c
parent 0 1918ee327afb
equal deleted inserted replaced
3:41300fa6a67c 7:f7bc934e204c
     1 /****************************************************************************
     1 /****************************************************************************
     2 **
     2 **
     3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
     3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
     4 ** All rights reserved.
     4 ** All rights reserved.
     5 ** Contact: Nokia Corporation (qt-info@nokia.com)
     5 ** Contact: Nokia Corporation (qt-info@nokia.com)
     6 **
     6 **
     7 ** This file is part of the QtNetwork module of the Qt Toolkit.
     7 ** This file is part of the QtNetwork module of the Qt Toolkit.
     8 **
     8 **
   100     Q_Q(QLocalSocket);
   100     Q_Q(QLocalSocket);
   101     QLocalSocket::LocalSocketState currentState = state;
   101     QLocalSocket::LocalSocketState currentState = state;
   102     switch(newState) {
   102     switch(newState) {
   103     case QAbstractSocket::UnconnectedState:
   103     case QAbstractSocket::UnconnectedState:
   104         state = QLocalSocket::UnconnectedState;
   104         state = QLocalSocket::UnconnectedState;
   105         serverName = QString();
   105         serverName.clear();
   106         fullServerName = QString();
   106         fullServerName.clear();
   107         break;
   107         break;
   108     case QAbstractSocket::ConnectingState:
   108     case QAbstractSocket::ConnectingState:
   109         state = QLocalSocket::ConnectingState;
   109         state = QLocalSocket::ConnectingState;
   110         break;
   110         break;
   111     case QAbstractSocket::ConnectedState:
   111     case QAbstractSocket::ConnectedState:
   216     Q_D(QLocalSocket);
   216     Q_D(QLocalSocket);
   217     if (state() == ConnectedState
   217     if (state() == ConnectedState
   218         || state() == ConnectingState)
   218         || state() == ConnectingState)
   219         return;
   219         return;
   220 
   220 
   221     d->errorString = QString();
   221     d->errorString.clear();
   222     d->state = ConnectingState;
   222     d->state = ConnectingState;
   223     emit stateChanged(d->state);
   223     emit stateChanged(d->state);
   224 
   224 
   225     if (name.isEmpty()) {
   225     if (name.isEmpty()) {
   226         d->errorOccurred(ServerNotFoundError,
   226         d->errorOccurred(ServerNotFoundError,
   331 
   331 
   332 void QLocalSocket::close()
   332 void QLocalSocket::close()
   333 {
   333 {
   334     Q_D(QLocalSocket);
   334     Q_D(QLocalSocket);
   335     d->tcpSocket->close();
   335     d->tcpSocket->close();
   336     d->serverName = QString();
   336     d->serverName.clear();
   337     d->fullServerName = QString();
   337     d->fullServerName.clear();
   338     QIODevice::close();
   338     QIODevice::close();
   339 }
   339 }
   340 
   340 
   341 bool QLocalSocket::waitForBytesWritten(int msecs)
   341 bool QLocalSocket::waitForBytesWritten(int msecs)
   342 {
   342 {