ret = init_unix_addr(&unix_addr, conf.afs_socket_arg);
if (ret < 0)
goto out;
- ret = -E_CONNECT;
- if (connect(fd, (struct sockaddr *)&unix_addr, sizeof(unix_addr)) < 0) /* FIXME: Use para_connect() */
+ ret = PARA_CONNECT(fd, &unix_addr);
+ if (ret < 0)
goto out;
ret = send_bin_buffer(fd, buf, sizeof(buf));
- PARA_NOTICE_LOG("bin buffer ret: %d\n", ret);
if (ret < 0)
goto out;
ret = recv_bin_buffer(fd, buf, sizeof(buf));
- PARA_NOTICE_LOG("ret: %d\n", ret);
if (ret < 0)
goto out;
if (ret != sizeof(int)) {
goto out;
}
ret = *(int *) buf;
- PARA_NOTICE_LOG("result_shmid: %d\n", ret);
if (ret <= 0)
goto out;
result_shmid = ret;
PARA_ERROR_LOG("%s\n", "shm destroy error");
if (fd >= 0)
close(fd);
- PARA_DEBUG_LOG("callback_ret: %d\n", ret);
+// PARA_DEBUG_LOG("callback_ret: %d\n", ret);
return ret;
}
t->ret = recv_bin_buffer(fd, buf, sizeof(buf));
if (t->ret < 0) {
PARA_NOTICE_LOG("%s (%d)\n", PARA_STRERROR(-t->ret), t->ret);
- t->ret = 1;
goto out;
}
if (t->ret != sizeof(buf)) {
PARA_NOTICE_LOG("short read (%d bytes, expected %lu)\n",
t->ret, (long unsigned) sizeof(buf));
- t->ret = 1;
goto out;
}
cookie = *(uint32_t *)buf;
if (cookie != ct->cookie) {
PARA_NOTICE_LOG("received invalid cookie(got %u, expected %u)\n",
(unsigned)cookie, (unsigned)ct->cookie);
- t->ret = 1;
goto out;
}
query_shmid = *(int *)(buf + sizeof(cookie));
if (query_shmid < 0) {
PARA_WARNING_LOG("received invalid query shmid %d)\n",
query_shmid);
- t->ret = 1;
- goto out;
- }
- t->ret = call_callback(fd, query_shmid);
- if (t->ret < 0) {
- PARA_NOTICE_LOG("%s\n", PARA_STRERROR(-t->ret));
- t->ret = 1;
goto out;
}
+ /* Ignore return value: Errors might be ok here. */
+ call_callback(fd, query_shmid);
out:
+ t->ret = 1;
close(fd);
}