Stuff connected with ctrlFd disabled

This commit is contained in:
Valery Yatsko 2008-04-02 21:16:13 +04:00
parent 360f052895
commit 32db3450e8
6 changed files with 11 additions and 150 deletions

View File

@ -254,10 +254,6 @@ struct LocalUser
/* time challenge response is valid for */
time_t chal_time;
int ctrlfd; /* 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 */

View File

@ -46,7 +46,6 @@
#define MAX_FLOOD 5
#define MAX_FLOOD_BURST MAX_FLOOD * 8
extern PF read_ctrl_packet;
extern PF read_packet;
extern EVH flood_recalc;
extern void flood_endgrace(struct Client *);

View File

@ -161,7 +161,6 @@ make_client(struct Client *from)
client_p->localClient->lasttime = client_p->localClient->firsttime = rb_current_time();
client_p->localClient->F = NULL;
client_p->localClient->ctrlfd = -1;
client_p->preClient = (struct PreClient *) rb_bh_alloc(pclient_heap);
@ -2095,14 +2094,6 @@ close_connection(struct Client *client_p)
client_p->localClient->F = NULL;
}
/* XXX servlink -- dwr
if(-1 < client_p->localClient->ctrlfd)
{
rb_close(client_p->localClient->ctrlfd);
client_p->localClient->ctrlfd = -1;
}
*/
rb_linebuf_donebuf(&client_p->localClient->buf_sendq);
rb_linebuf_donebuf(&client_p->localClient->buf_recvq);
detach_conf(client_p);

View File

@ -224,132 +224,6 @@ flood_recalc(void *unused)
}
}
/*
* read_ctrl_packet - Read a 'packet' of data from a servlink control
* link and process it.
*/
void
read_ctrl_packet(int fd, void *data)
{
struct Client *server = data;
struct LocalUser *lserver = server->localClient;
struct SlinkRpl *reply;
int length = 0;
unsigned char tmp[2];
unsigned char *len = tmp;
struct SlinkRplDef *replydef;
#ifdef USE_IODEBUG_HOOKS
hook_data_int hdata;
#endif
s_assert(lserver != NULL);
if(IsAnyDead(server))
return;
reply = &lserver->slinkrpl;
if(!reply->command)
{
reply->gotdatalen = 0;
reply->readdata = 0;
reply->data = NULL;
length = read(fd, tmp, 1);
if(length <= 0)
{
if((length == -1) && ignoreErrno(errno))
goto nodata;
error_exit_client(server, length);
return;
}
reply->command = tmp[0];
}
for (replydef = slinkrpltab; replydef->handler; replydef++)
{
if((int)replydef->replyid == reply->command)
break;
}
/* we should be able to trust a local slink process...
* and if it sends an invalid command, that's a bug.. */
s_assert(replydef->handler);
if((replydef->flags & SLINKRPL_FLAG_DATA) && (reply->gotdatalen < 2))
{
/* we need a datalen u16 which we don't have yet... */
length = read(fd, len, (2 - reply->gotdatalen));
if(length <= 0)
{
if((length == -1) && ignoreErrno(errno))
goto nodata;
error_exit_client(server, length);
return;
}
if(reply->gotdatalen == 0)
{
reply->datalen = *len << 8;
reply->gotdatalen++;
length--;
len++;
}
if(length && (reply->gotdatalen == 1))
{
reply->datalen |= *len;
reply->gotdatalen++;
if(reply->datalen > 0)
reply->data = rb_malloc(reply->datalen);
}
if(reply->gotdatalen < 2)
return; /* wait for more data */
}
if(reply->readdata < reply->datalen) /* try to get any remaining data */
{
length = read(fd, (reply->data + reply->readdata),
(reply->datalen - reply->readdata));
if(length <= 0)
{
if((length == -1) && ignoreErrno(errno))
goto nodata;
error_exit_client(server, length);
return;
}
reply->readdata += length;
if(reply->readdata < reply->datalen)
return; /* wait for more data */
}
#ifdef USE_IODEBUG_HOOKS
hdata.client = server;
hdata.arg1 = NULL;
hdata.arg2 = reply->command;
hdata.data = NULL;
call_hook(h_iorecvctrl_id, &hdata);
#endif
/* we now have the command and any data, pass it off to the handler */
(*replydef->handler) (reply->command, reply->datalen, reply->data, server);
/* reset SlinkRpl */
if(reply->datalen > 0)
rb_free(reply->data);
reply->command = 0;
if(IsAnyDead(server))
return;
nodata:
/* If we get here, we need to register for another COMM_SELECT_READ */
rb_setselect(fd, FDLIST_SERVER, COMM_SELECT_READ, read_ctrl_packet, server, 0);
}
/*
* read_packet - Read a 'packet' of data from a connection and process it.
*/

View 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->ctrlfd, target_p);
}
}
}
@ -1140,7 +1140,7 @@ server_estab(struct Client *client_p)
* client_p->name + 64
*/
rb_note(client_p->localClient->F->fd, "slink data: %s", client_p->name);
rb_note(client_p->localClient->ctrlfd, "slink ctrl: %s", client_p->name);
// rb_note(client_p->localClient->ctrlfd, "slink ctrl: %s", client_p->name);
}
else
rb_note(client_p->localClient->F->fd, "Server: %s", client_p->name);
@ -1310,7 +1310,7 @@ start_io(struct Client *server)
server->localClient->slinkq_len = c;
/* schedule a write */
send_queued_slink_write(server->localClient->ctrlfd, server);
// send_queued_slink_write(server->localClient->ctrlfd, server);
}
/*
@ -1404,7 +1404,7 @@ fork_server(struct Client *server)
close(data_fds[1]);
s_assert(server->localClient);
server->localClient->ctrlfd = ctrl_fds[0];
// server->localClient->ctrlfd = ctrl_fds[0];
server->localClient->F = rb_add_fd(data_fds[0]);
if(!rb_set_nb(server->localClient->F->fd))
@ -1415,7 +1415,7 @@ fork_server(struct Client *server)
errno);
}
if(!rb_set_nb(server->localClient->ctrlfd))
/* if(!rb_set_nb(server->localClient->ctrlfd))
{
report_error(NONB_ERROR_MSG,
get_server_name(server, SHOW_IP),
@ -1424,9 +1424,10 @@ fork_server(struct Client *server)
}
rb_open(server->localClient->ctrlfd, FD_SOCKET, NULL);
*/
rb_open(server->localClient->F->fd, FD_SOCKET, NULL);
read_ctrl_packet(server->localClient->ctrlfd, server);
read_packet(server->localClient->F->fd, server);
}

View File

@ -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 = write(to->localClient->ctrlfd,
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)
/* if(to->localClient->slinkq_len)
rb_setselect(to->localClient->ctrlfd,
RB_SELECT_WRITE, send_queued_slink_write, to);
RB_SELECT_WRITE, send_queued_slink_write, to); */
}
/* sendto_one()