Merge branch 'master' into my-osx
[paraslash.git] / client_common.c
index 8bca7b7f04e237e4bfb0b477b828ae6678f9f2aa..c738079b6b1f92ab47435bfea9eb6185aa52eef2 100644 (file)
@@ -50,8 +50,10 @@ void client_close(struct private_client_data *pcd)
 {
        if (pcd)
                return;
-       if (pcd->fd >= 0)
+       if (pcd->fd >= 0) {
+               disable_crypt(pcd->fd);
                close(pcd->fd);
+       }
        free(pcd->user);
        free(pcd->config_file);
        free(pcd->key_file);
@@ -276,11 +278,8 @@ void client_post_select(struct sched *s, struct task *t)
        case CL_SENDING: /* FIXME: might block */
                PARA_INFO_LOG("loaded: %zd\n", *pcd->in_loaded);
                t->ret = send_bin_buffer(pcd->fd, pcd->inbuf, *pcd->in_loaded);
-               if (t->ret <= 0) {
-                       if (!t->ret)
-                               t->ret = 1;
+               if (t->ret < 0)
                        return;
-               }
                *pcd->in_loaded = 0; /* FIXME: short writes */
                return;
        case CL_RECEIVING: