Пример #1
0
void CommunicationServer::read_socks(void) {
	int listnum;
	if(FD_ISSET(sock, &socks)) {
		printf("accepting..\n\r");
		handle_new_connection();
	}
	for(listnum = 0; listnum < 1024; listnum++) {
		if(FD_ISSET(connectlist[listnum], &socks))
			deal_with_data(listnum);
	}
	return;
}
Пример #2
0
static int parse_rbuf(struct asfd *asfd, struct sbuf *sb,
	BFILE *bfd, size_t *datalen, struct conf *conf)
{
	static struct iobuf *rbuf;
	rbuf=asfd->rbuf;
	//logp("now: %c:%s\n", rbuf->cmd, rbuf->buf);
	if(rbuf->cmd==CMD_DATAPTH)
	{
		iobuf_copy(&(sb->burp1->datapth), rbuf);
		rbuf->buf=NULL;
	}
	else if(rbuf->cmd==CMD_ATTRIBS)
	{
		// Ignore the stat data - we will fill it
		// in again. Some time may have passed by now,
		// and it is best to make it as fresh as
		// possible.
	}
	else if(rbuf->cmd==CMD_FILE
	  || rbuf->cmd==CMD_ENC_FILE
	  || rbuf->cmd==CMD_METADATA
	  || rbuf->cmd==CMD_ENC_METADATA
	  || rbuf->cmd==CMD_VSS
	  || rbuf->cmd==CMD_ENC_VSS
	  || rbuf->cmd==CMD_VSS_T
	  || rbuf->cmd==CMD_ENC_VSS_T
	  || rbuf->cmd==CMD_EFS_FILE)
	{
		if(deal_with_data(asfd, sb, bfd, datalen, conf))
			return -1;
	}
	else if(rbuf->cmd==CMD_WARNING)
	{
		cntr_add(conf->cntr, rbuf->cmd, 0);
	}
	else
	{
		iobuf_log_unexpected(rbuf, __func__);
		return -1;
	}
	return 0;
}
Пример #3
0
void read_socks(User *listUs,QA *listQA) {
	int listnum;	     /* Current item in connectlist for for loops */
	
	/* If a client is trying to connect() to our listening
		socket, select() will consider that as the socket
		being 'readable'. Thus, if the listening socket is
		part of the fd_set, we need to accept a new connection. */
	
	if (FD_ISSET(sock,&socks))
		handle_new_connection();
	/* Now check connectlist for available data */
	
	/* Run through our sockets and check to see if anything
		happened with them, if so 'service' them. */
	
	for (listnum = 0; listnum < BACKLOG; listnum++) {
		if (FD_ISSET(connectlist[listnum],&socks))
		  deal_with_data(listnum,listUs,listQA);
	} /* for (all entries in queue) */
}