int ret = client->Send(parcel.GetData(), parcel.GetDataSize());
if (ret != 0 || opt & AUL_SOCK_NOREPLY) {
- if (opt & AUL_SOCK_ASYNC)
- client->RemoveFd();
+ if (!(opt & AUL_SOCK_ASYNC))
+ client->Close();
return ret;
}
int SendAndReceive(int fd, int cmd, unsigned char* data, int datalen,
int opt) {
ClientSocket client(fd);
- return SendAndReceive(&client, cmd, data, datalen, opt);
+ int ret = SendAndReceive(&client, cmd, data, datalen, opt);
+ if (ret < 0) {
+ if (opt & AUL_SOCK_ASYNC)
+ client.RemoveFd();
+ }
+
+ return ret;
}
int SendAndReceive(int pid, uid_t uid, int cmd, unsigned char* data,