Ziplinks appear to work again now.

This commit is contained in:
Jilles Tjoelker 2008-04-04 00:13:50 +02:00
parent 99a80a9151
commit 83b667df88
5 changed files with 28 additions and 19 deletions

View File

@ -254,6 +254,10 @@ struct LocalUser
/* time challenge response is valid for */ /* time challenge response is valid for */
time_t chal_time; 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 */ struct SlinkRpl slinkrpl; /* slink reply being parsed */
unsigned char *slinkq; /* sendq for control data */ unsigned char *slinkq; /* sendq for control data */
int slinkq_ofs; /* ofset into slinkq */ int slinkq_ofs; /* ofset into slinkq */

View File

@ -42,7 +42,7 @@ extern void send_pop_queue(struct Client *);
extern void send_queued(struct Client *to); 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(struct Client *target_p, const char *, ...) AFP(2, 3);
extern void sendto_one_notice(struct Client *target_p,const char *, ...) AFP(2, 3); extern void sendto_one_notice(struct Client *target_p,const char *, ...) AFP(2, 3);

View File

@ -161,6 +161,7 @@ make_client(struct Client *from)
client_p->localClient->lasttime = client_p->localClient->firsttime = rb_current_time(); client_p->localClient->lasttime = client_p->localClient->firsttime = rb_current_time();
client_p->localClient->F = NULL; client_p->localClient->F = NULL;
client_p->localClient->ctrlF = NULL;
client_p->preClient = (struct PreClient *) rb_bh_alloc(pclient_heap); 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; 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_sendq);
rb_linebuf_donebuf(&client_p->localClient->buf_recvq); rb_linebuf_donebuf(&client_p->localClient->buf_recvq);
detach_conf(client_p); detach_conf(client_p);

View File

@ -218,7 +218,7 @@ collect_zipstats(void *unused)
target_p->localClient->slinkq[0] = SLINKCMD_ZIPSTATS; target_p->localClient->slinkq[0] = SLINKCMD_ZIPSTATS;
target_p->localClient->slinkq_ofs = 0; target_p->localClient->slinkq_ofs = 0;
target_p->localClient->slinkq_len = 1; 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_snprintf(note, sizeof note, "slink data: %s", client_p->name);
rb_note(client_p->localClient->F, note); 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 else
{ {
@ -1313,7 +1314,7 @@ start_io(struct Client *server)
server->localClient->slinkq_len = c; server->localClient->slinkq_len = c;
/* schedule a write */ /* 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]); close(data_fds[1]);
s_assert(server->localClient); 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"); server->localClient->F = rb_open(data_fds[0], RB_FD_PIPE, "servlink data");
if(!rb_set_nb(server->localClient->ctrlF))
{
ilog_error("setting a slink fd nonblocking");
}
if(!rb_set_nb(server->localClient->F)) if(!rb_set_nb(server->localClient->F))
{ {
ilog_error("setting a slink fd nonblocking"); ilog_error("setting a slink fd nonblocking");
} }
/* if(!rb_set_nb(server->localClient->ctrlfd))
{
ilog_error("setting a slink fd nonblocking");
}
rb_open(server->localClient->ctrlfd, FD_SOCKET, NULL);
*/
read_packet(server->localClient->F, server); read_packet(server->localClient->F, server);
} }

View File

@ -219,7 +219,7 @@ send_queued_write(rb_fde_t *F, void *data)
* side effects - write is rescheduled if queue isnt emptied * side effects - write is rescheduled if queue isnt emptied
*/ */
void void
send_queued_slink_write(int fd, void *data) send_queued_slink_write(rb_fde_t *F, void *data)
{ {
struct Client *to = data; struct Client *to = data;
int retlen; int retlen;
@ -234,9 +234,9 @@ send_queued_slink_write(int fd, void *data)
/* Next, lets try to write some data */ /* Next, lets try to write some data */
if(to->localClient->slinkq) 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 + to->localClient->slinkq_ofs,
to->localClient->slinkq_len); */ to->localClient->slinkq_len);
if(retlen < 0) 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 we have any more data, reschedule a write */
/* if(to->localClient->slinkq_len) if(to->localClient->slinkq_len)
rb_setselect(to->localClient->ctrlfd, rb_setselect(to->localClient->ctrlF,
RB_SELECT_WRITE, send_queued_slink_write, to); */ RB_SELECT_WRITE, send_queued_slink_write, to);
} }
/* sendto_one() /* sendto_one()