am ff856a2b: Merge "Add error handling to SocketClient::sendData"
* commit 'ff856a2b927aaadb189181d2cd9dd08dc98456a4': Add error handling to SocketClient::sendData
This commit is contained in:
commit
7bb1b9585d
1 changed files with 5 additions and 5 deletions
|
|
@ -64,11 +64,6 @@ int SocketClient::sendMsg(int code, const char *msg, bool addErrno) {
|
|||
}
|
||||
|
||||
int SocketClient::sendMsg(const char *msg) {
|
||||
if (mSocket < 0) {
|
||||
errno = EHOSTUNREACH;
|
||||
return -1;
|
||||
}
|
||||
|
||||
// Send the message including null character
|
||||
if (sendData(msg, strlen(msg) + 1) != 0) {
|
||||
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;
|
||||
int brtw = len;
|
||||
|
||||
if (mSocket < 0) {
|
||||
errno = EHOSTUNREACH;
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (len == 0) {
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue