]> jfr.im git - irc/rqf/shadowircd.git/commitdiff
Ziplinks appear to work again now.
authorJilles Tjoelker <redacted>
Thu, 3 Apr 2008 22:13:50 +0000 (00:13 +0200)
committerJilles Tjoelker <redacted>
Thu, 3 Apr 2008 22:13:50 +0000 (00:13 +0200)
include/client.h
include/send.h
src/client.c
src/s_serv.c
src/send.c

index f6a1371b06d942714b26c9f659792f7381e0da33..6f3d62a095f1c44a6244b284aa93068d77d5f0e8 100644 (file)
@@ -254,6 +254,10 @@ struct LocalUser
        /* time challenge response is valid for */
        time_t chal_time;
 
+       rb_fde_t *ctrlF;        /* For servers:
+                                  control fd used for sending commands
+                                  to servlink */
+
        struct SlinkRpl slinkrpl;       /* slink reply being parsed */
        unsigned char *slinkq;  /* sendq for control data */
        int slinkq_ofs;         /* ofset into slinkq */
index 1e5b023d631b6e27dec7573c4c7ffb66fee72ee5..20b623f1e01cefa1789e8c14d701ddd69a5a0cd6 100644 (file)
@@ -42,7 +42,7 @@ extern void send_pop_queue(struct Client *);
 
 extern void send_queued(struct Client *to);
 
-extern void send_queued_slink_write(int fd, void *data);
+extern void send_queued_slink_write(rb_fde_t *F, void *data);
 
 extern void sendto_one(struct Client *target_p, const char *, ...) AFP(2, 3);
 extern void sendto_one_notice(struct Client *target_p,const char *, ...) AFP(2, 3);
index aa2a0e9443f4cf45f2d12bb4d3df7f6c9dc1a878..54eeaf5a4e368180010219d34b5499a343fc8b90 100644 (file)
@@ -161,6 +161,7 @@ make_client(struct Client *from)
                client_p->localClient->lasttime = client_p->localClient->firsttime = rb_current_time();
 
                client_p->localClient->F = NULL;
+               client_p->localClient->ctrlF = NULL;
 
                client_p->preClient = (struct PreClient *) rb_bh_alloc(pclient_heap);
 
@@ -2094,6 +2095,12 @@ close_connection(struct Client *client_p)
                client_p->localClient->F = NULL;
        }
 
+       if(client_p->localClient->ctrlF)
+       {
+               rb_close(client_p->localClient->ctrlF);
+               client_p->localClient->ctrlF = NULL;
+       }
+
        rb_linebuf_donebuf(&client_p->localClient->buf_sendq);
        rb_linebuf_donebuf(&client_p->localClient->buf_recvq);
        detach_conf(client_p);
index bf98cffe8912cdd50c410cc5ccf4a8e475205b5e..189f3a488eb6403fd8af90b754ad38b1bbada130 100644 (file)
@@ -218,7 +218,7 @@ collect_zipstats(void *unused)
                                target_p->localClient->slinkq[0] = SLINKCMD_ZIPSTATS;
                                target_p->localClient->slinkq_ofs = 0;
                                target_p->localClient->slinkq_len = 1;
-                               // send_queued_slink_write(target_p->localClient->ctrlfd, target_p);
+                               send_queued_slink_write(target_p->localClient->ctrlF, target_p);
                        }
                }
        }
@@ -1140,7 +1140,8 @@ server_estab(struct Client *client_p)
                 */
                rb_snprintf(note, sizeof note, "slink data: %s", client_p->name);
                rb_note(client_p->localClient->F, note);
-               // rb_note(client_p->localClient->ctrlfd, "slink ctrl: %s", client_p->name);
+               rb_snprintf(note, sizeof note, "slink ctrl: %s", client_p->name);
+               rb_note(client_p->localClient->ctrlF, note);
        }
        else
        {
@@ -1313,7 +1314,7 @@ start_io(struct Client *server)
        server->localClient->slinkq_len = c;
 
        /* schedule a write */
-       //XXX send_queued_slink_write(server->localClient->ctrlF, server);
+       send_queued_slink_write(server->localClient->ctrlF, server);
 }
 
 /*
@@ -1407,22 +1408,19 @@ fork_server(struct Client *server)
                close(data_fds[1]);
                
                s_assert(server->localClient);
-               // server->localClient->ctrlfd = ctrl_fds[0];
+               server->localClient->ctrlF = rb_open(ctrl_fds[0], RB_FD_PIPE, "servlink ctrl");
                server->localClient->F = rb_open(data_fds[0], RB_FD_PIPE, "servlink data");
 
-               if(!rb_set_nb(server->localClient->F))
+               if(!rb_set_nb(server->localClient->ctrlF))
                {
                        ilog_error("setting a slink fd nonblocking");
                }
 
-               /* if(!rb_set_nb(server->localClient->ctrlfd))
+               if(!rb_set_nb(server->localClient->F))
                {
                        ilog_error("setting a slink fd nonblocking");
                }
 
-               rb_open(server->localClient->ctrlfd, FD_SOCKET, NULL);
-               */
-
                read_packet(server->localClient->F, server);
        }
 
index 9cbfae734cd5d3b36207fd66df3b5a301ed07407..4b64c2d9d49091b977e8f62d714075e08ca692c9 100644 (file)
@@ -219,7 +219,7 @@ send_queued_write(rb_fde_t *F, void *data)
  * side effects - write is rescheduled if queue isnt emptied
  */
 void
-send_queued_slink_write(int fd, void *data)
+send_queued_slink_write(rb_fde_t *F, void *data)
 {
        struct Client *to = data;
        int retlen;
@@ -234,9 +234,9 @@ send_queued_slink_write(int fd, void *data)
        /* Next, lets try to write some data */
        if(to->localClient->slinkq)
        {
-               /* retlen = write(to->localClient->ctrlfd,
+               retlen = rb_write(to->localClient->ctrlF,
                              to->localClient->slinkq + to->localClient->slinkq_ofs,
-                             to->localClient->slinkq_len); */
+                             to->localClient->slinkq_len);
 
                if(retlen < 0)
                {
@@ -270,9 +270,9 @@ send_queued_slink_write(int fd, void *data)
        }
 
        /* if we have any more data, reschedule a write */
-       /* if(to->localClient->slinkq_len)
-               rb_setselect(to->localClient->ctrlfd,
-                              RB_SELECT_WRITE, send_queued_slink_write, to); */
+       if(to->localClient->slinkq_len)
+               rb_setselect(to->localClient->ctrlF,
+                              RB_SELECT_WRITE, send_queued_slink_write, to);
 }
 
 /* sendto_one()