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

ProFTPD和WU-FTP的BANDWIDTH控制

 2007-06-12 00:00:00 来源:WEB开发网   
核心提示: if(!p) { @@ -433,10 +608,53 @@ cnt espos; log_add_run(mpid,NULL,session.user,NULL,0,session.xfer.file_size, 0,NULL); + /* Calculate bandwidth transf

if(!p) { @@ -433,10 +608,53 @@ cnt espos; log_add_run(mpid,NULL,session.user,NULL,0,session.xfer.file_size, 0,NULL);

+ /* Calculate bandwidth transfer time + * + * if "BandWidth" , "MaxBandWidth" or "MinBandWidth" not be defin ed or + * be defined error. i will turn off bandwidth limit. + */ + + cur_user long)get_param_int(cmd->server->conf,"CURRENT-CLIENTS",F ALSE)+1; + cur_rate long)get_param_int(cmd->server->conf,"Bandwidth",FALSE);

+ max_rate long)get_param_int(cmd->server->conf,"MaxBandwidth",FALS E); + min_rate long)get_param_int(cmd->server->conf,"MinBandwidth",FALS E); + + cur_rate □r_rate / cur_user; + + if(max_rate <□) + max_rate □; + if(min_rate <□) + min_rate □; + if(cur_rate <□) + { + if(max_rate > 0L) + cur_rate ax_rate; + else if(min_rate > 0L) + cur_rate in_rate; + else + cur_rate □; + } + + if((cur_rate > max_rate) && (max_rate > 0L)) + cur_rate ax_rate; + if(min_rate > cur_rate) + cur_rate in_rate; + + if(cur_rate > 0L) { + opt_time.tv_sec long int) bufsize / cur_rate; + opt_time.tv_usec long int) ((float) bufsize * 1000000 / cur_rat e - opt_time.tv_sec * 1000000); + log_debug(DEBUG1, "Current Bandwidth : %ld bytes/sec",cur_rate) ; + } + while((len s_read(retr_file,retr_fd,lbuf,bufsize)) > 0) { if(XFER_ABORTED) break;

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

Tags:ProFTPD WU FTP

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