WEB开发网
开发学院服务器FTP服务器 ProFTPD及WU-FTP的BANDWIDTH控制 阅读

ProFTPD及WU-FTP的BANDWIDTH控制

 2007-12-03 16:20:31 来源:WEB开发网   
核心提示:extern module auth_module; extern pid_t mpid; @@ -51,6 +181,7 @@ static int stor_fd; static int retr_fd; + module xfer_module; static void _log_transfer(char di

extern module auth_module; extern pid_t mpid; @@ -51,6 +181,7 @@ static int stor_fd; static int retr_fd;

+ module xfer_module;

static void _log_transfer(char direction) @@ -129,6 +260,48 @@ retr_file ULL; }

+static struct timeval timediff(struct timeval *a, struct timeval *b)

+{ + struct timeval rslt, tmp; + + tmp a; + + if ((rslt.tv_usec mp.tv_usec - b->tv_usec) < 0) { + rslt.tv_usec +□00000; + --(tmp.tv_sec); + } + if ((rslt.tv_sec mp.tv_sec - b->tv_sec) < 0) { + rslt.tv_usec □ + rslt.tv_sec □ + } + return (rslt); +} + +void handler(int sig) +{ + return; +} + +int sleep_msec(struct timeval *a) +{ + struct timeval tmp; + struct itimerval itimer; + void handler(); + + tmp a; + + if (timerisset(&tmp)) { + signal(SIGALRM,handler); + timerclear(&itimer.it_interval); + itimer.it_value.tv_usecp.tv_usec; + itimer.it_value.tv_secp.tv_sec; + setitimer(ITIMER_REAL,&itimer,(struct itimerval *)0); + pause(); + timerclear(&itimer.it_value); + setitimer(ITIMER_REAL,&itimer,(struct itimerval *)0); + } +} + /* cmd_pre_stor is a PRE_CMD handler which checks security, etc, and

* places the full filename to receive in cmd->private [note that we CANNOT * use cmd->tmp_pool for this, as tmp_pool only lasts for the duratio n @@ -384,9 +557,11 @@ struct stat sbuf; char *lbuf; int bufsize,len; + long cur_rate □max_rate □min_rate □cur_user □ unsigned long respos □cnt □cnt_steps □cnt_next □ privdata_t *p; - + struct timeval opt_time, last_time, now, timespent, timeout; + p od_privdata_find(cmd,"retr_filename",NULL);

上一页  1 2 3 4 5 6  下一页

Tags:ProFTPD WU FTP

编辑录入:爽爽 [复制链接] [打 印]
赞助商链接