Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ff856a2b authored by Robert Greenwalt's avatar Robert Greenwalt Committed by android code review
Browse files

Merge "Add error handling to SocketClient::sendData"

parents 1d5e7885 2e5fcd08
Loading
Loading
Loading
Loading
+5 −5
Original line number Original line Diff line number Diff line
@@ -64,11 +64,6 @@ int SocketClient::sendMsg(int code, const char *msg, bool addErrno) {
}
}


int SocketClient::sendMsg(const char *msg) {
int SocketClient::sendMsg(const char *msg) {
    if (mSocket < 0) {
        errno = EHOSTUNREACH;
        return -1;
    }

    // Send the message including null character
    // Send the message including null character
    if (sendData(msg, strlen(msg) + 1) != 0) {
    if (sendData(msg, strlen(msg) + 1) != 0) {
        SLOGW("Unable to send msg '%s'", msg);
        SLOGW("Unable to send msg '%s'", msg);
@@ -82,6 +77,11 @@ int SocketClient::sendData(const void* data, int len) {
    const char *p = (const char*) data;
    const char *p = (const char*) data;
    int brtw = len;
    int brtw = len;


    if (mSocket < 0) {
        errno = EHOSTUNREACH;
        return -1;
    }

    if (len == 0) {
    if (len == 0) {
        return 0;
        return 0;
    }
    }