Goodbye, P2P! P4P is Coming

Goodbye, P2P! P4P is Coming
Written by Sarah Perez / March 14, 2008 8:12 AM / 10 Comments

P2P, or peer-to-peer, is the protocol currently used by many file sharing networks for moving large files over the internet. Now, a new protocol, P4P – aka Proactive network Provider Participation for P2P – is being introduced by Verizon. P4P’s goal is to reduce backbone traffic and lower network operation costs. Will P4P bring us the bandwidth we’ve been waiting for?

Unlike P2P, which selects random peers to share with, when using P4P the peers are intelligently selected as the protocol utilizes network topology data to maximize the efficiency of routing between the peer-to-peer connections.

Verizon just tested P4P with Pando and received performance boosts of 200 percent on average and increases of up to 600 percent in some cases.

What’s most remarkable about this story is that Verizon is looking towards working with P2P traffic instead of throttling it like Comcast has been doing lately.

At an upcoming conference in New York, Verizon will present their test results, which show that when an ISP cooperates with file-sharing, they can speed downloads an average of 60 percent.

“This test signifies a turning point in the history of peer-to-peer technology and ISPs,” said Robert Levitan, chief executive of Pando Networks Inc. “It will definitely show ISPs that the problem is not peer-to-peer technology, the problem is how you deploy it. It is possible to deploy P2P to their advantage. The Internet is quickly transforming into a media distribution platform, and there are people who say: ‘It will break. It’s not built to move music and movies and games and software.’ New technologies are needed, and this is one of those technologies.”

The P4P protocol may even be ready by next month, when NBC begins offering HD downloads of popular TV shows via the Pando software.

http://www.readwriteweb.com/archives/goodbye_p2p_p4p_is_coming.php

彻底ft了

早上洗漱,刷牙。

挤了点牙膏。咦,为什么今天的牙膏有点细,而且是灰色的呢?

糊涂了,糊涂了。静下心来想想,嗯,好像不对,貌似记得不是牙膏,而是洗面奶,洗面奶,洗面奶……

回到实验室,看到btcomet挂掉了,以前下载的火箭vs丹佛比赛只有下半场,就这样看吧。没想到画面中还有霍二叔,还出现了范甘迪!!居然时光倒退了……

仔细看看目录名,居然是07年的比赛,ft啊,怪不得下不下来……

看了几篇硕士论文

准备了解一些IPv6的组播技术,搜了一些论文,中文的材料不少是硕士论文,格式都是扫描的nh文件,看起来挺不爽,linux下面还没有专门的工具,看的话需要转成pdf,麻烦。

不说这个了,单看内容,由于先前对这个领域不太了解,所以先看一些中文的资料容易入门。一般论文的前三章还算不错,都是介绍性的内容,挺对口的。不过之后的就没法看了,尤其是系统设计部分。

你介绍一下系统设计原理也就罢了,我看得4篇文章有3篇是用windows,结果把winsock的IPv6部分介绍一般,,包括数据结构,多数还带代码实现的……
剩下的那篇倒是没这么详细,也没出数据结构,因为那篇是IPv6组播技术的分析和研究,分析为主,然后是抓包分析协议,最后实现一个组播的聊天系统,结果他还把VS.Net的安装界面还截屏了,ft啊。

这tm都什么硕士啊,难怪我要读博士,受不了了……

立个目标,我的毕设没事不会出现数据结构、代码(算法的伪代码除外)和非相关截屏。嗯,就这么办吧。

访问人数统计

今天想看看lilac的访问统计,数据在http://lilacbbs.com/bbsstat/。
结果发现所有的图都是一样的,ft

原来没有开启dayuserlog程序,这个程序每小时运行10次左右,然后由alluserlog统计平均人数,最后由脚本调用gnuplot画出图来。

现在启动,希望会有变化的。

————————————–
现在貌似正常了,嗯 -2008-02-29

下载免费vs 2008

首先说明一点,这个是给在校学生提供的,用于学习和研究性质。

先到http://www.msuniversity.edu.cn,首页下面有一行字:“高校在校学生可以完全免费的在非商业性的学习、科研和课内外实践中使用微软学生软件资源中的软件工具。”,点击下面的按钮继续,之后会告诉你一系列事情,包括注册id之类的,然后会到http://www.msuniversity.edu.cn/m_DirectDownload/DownLoad.aspx。

最后要到国外的网站获得product key。https://downloads.channel8.msdn.com/Products/Visual_Studio_2008.aspx

具体的步骤msuniversity上面有说明。现在key弄到了,不过文件还没下载下来。

日志啊日志

开发和调试有时候真的是一件很灵异的事情,所以如果你胆小就不要做软件了。

前两天deem向我要一些lilac的用户日志,当时我看了一下,发现用户日志只有去年7月份的……

用户日志只有去年7月份的……
用户日志只有去年7月份的……
用户日志只有去年7月份的……

更诡异的是boardusage日志都没有问题,这就说明bbslogd和bbsd运行都没有问题,而且日志文件权限也没错,ft啊。

在bbsd跟踪了一下,日志信息是通过共享内存的message queue实现的,直到最后一步msd_send都没有问题。但是此时ipcs的msg queue中始终为0,灵异啊!

今天deem又问了一下,讲了他的一些想法,不过我觉得都不可能。于是下决心用gdb attach那个bbslogd。

从msg recv到写到msg队列中都没有问题,剩下的就是定时的flush了。迷糊了,detach一下,回头发现所有的日志文件都出现了……

所有的日志文件都出现了!!
所有的日志文件都出现了!!
所有的日志文件都出现了!!

ft
———————–ft的分界线——————
为什么嘞?

想了一下,可能是这样的,其实日志rotate需要给bbslogd发一个USR1的信号,这个需要手动在crontab设置一下。一直没有发信号,所以一直没有rotate。

但是问题为什么文件会小时呢?这个我就不知道了……

mp3编码终极方法

linux下到mp3播放器很头疼的是mp3文件的编码问题,很多文件的编码说明并不标准,所以linux下的mp3播放器几乎都不能正确识别。

原来我的方法是把文件名设置为playlist中的信息,但是这样有很多文件是 01-xxxx这样的格式,导致多出一个编号来,很不好看,而且tag中其他字段也还是乱码。

今天找了一下,python-mutagen这个东西很不错:

apt-install python-mutagen
find . -iname “*.mp3” -execdir mid3iconv -e gbk –remove-v1 {} ;

速度很快,效果也很好,没有问题。

B.T.W. 我现在用的mp3 player是amarok,歌词显示软件是lrcShow II,感觉不错。

bbs web启动问题

安装好系统之后,启动apache,此时使用浏览器访问,但是firefox是提示下载一个空的文件,而konqueror老是说broken connection,我抓包之后感觉是客户端向服务器发送完请求,服务器段由于内部处理失败,结果整个apache的子进程就退出了,所以这个连接就断了。于是出现了上述现象。
我觉得原因应该是apache的子进程在运行php扩展模块的时候,出现了segment fault。
我遇到的更具体原因有:
1 apache的属主不为bbs,此时运行bbs的程序,内部因为权限不对而发生异常。
2 客户端调用功能的时候没有初始化,此时共享内存没有被解析,如果访问共享内存,则会发生异常。

kbs系统phplib开发简介

写这篇文章的原因是向lilac dev组介绍一下如何入门 lilac bbs web 的开发,由于lilac bbs 是基于kbs系统的,所以我主要讲的也是基于kbs系统的web开发。

kbs系统的web主要分为三个部分:php页面开发,php扩展和底层的c语言函数库。

php页面开发主要涉及的就是我们常用的php常规开发,其实就是一个php的解释器解释运行php页面,再加上css、js和html那些东西。

php扩展是使用zend的特性,它可以将c语言编写的代码编译成二进制文件,然后将这个二进制文件加载为一个php的库文件(.so格式),由apache启动的时候检查注册,然后在上层的php页面中被动态载入、调用和释放。

至于底层的C语言函数库,其实就是用C语言写的函数的集合,可以供php扩展中的C语言代码调用的。仅此而已。

我打算用自底向上的方法讲,就举一个最简单的实例吧:用户登录。

首先,我们先看一个用C语言编写的验证用户信息的函数checkpasswd2,这个函数在libBBS/pass.c中:

71 int checkpasswd2(const char *passwd, const struct userec *user)
72 {
73 #ifdef CONV_PASS
74 if (user->passwd[0]) {
75 return checkpasswd(user->passwd, passwd);
76 } else
77 #endif
78 {
79 unsigned char md5passwd[MD5_DIGEST_LENGTH];
80
81 igenpass(passwd, user->userid, md5passwd);
82 /*
83 if (memcmp(md5passwd,user->md5passwd,MD5_DIGEST_LENGTH)) {
84 unsigned char w_md5passwd[MD5_DIGEST_LENGTH];
85 w_igenpass(passwd,user->userid,w_md5passwd);
86 if (memcmp(w_md5passwd,user->md5passwd,MD5_DIGEST_LENGTH)) return 0;
87 memcpy(user->md5passwd,md5passwd,MD5_DIGEST_LENGTH);
88 bbslog("5system","Convert %s password.",user->userid);
89 }
90 return 1;
91 */
92 return !(memcmp(md5passwd, user->md5passwd, MD5_DIGEST_LENGTH));
93 }
94 }

看起来应该很简单,比较明了。这就是一个最基本的kbs函数,几乎没有什么依赖项。这个函数可以被ssh、telnet和www这些上层的应用调用,但是底层就是这一个函数。

做完验证函数之后,我们需要编写一个php扩展。要使php页面能够用到这个checkpasswd2函数,那么我们需要有一个php扩展,其中有一个函数bbs_checkpasswd,这个函数其实是一个适配器,连接php页面的调用和checkpasswd2函数。这个函数在bbs2www/phplib/phpbbs.user.c:

PHP_FUNCTION(bbs_checkpasswd)
114 {
115 char *s;
116 int s_len;
117 char *pw;
118 int pw_len;
119 long ret;
120 int unum = 0;
121 long ismd5 = 0;
122 struct userec *user;
123 int ac = ZEND_NUM_ARGS();
124
125 if (ac != 2 || zend_parse_parameters(2 TSRMLS_CC, "ss", &s, &s_len, &pw, &pw_len) != SUCCESS) {
126 if (ac!= 3 || zend_parse_parameters(3 TSRMLS_CC, "ssl", &s, &s_len, &pw, &pw_len, &ismd5) != SUCCESS) {
127 WRONG_PARAM_COUNT;
128 }
129 }
130 if (s_len > IDLEN)
131 s[IDLEN] = 0;
132 if (pw_len > PASSLEN)
133 pw[PASSLEN] = 0;
134 if (pw[0] == '')
135 ret = 1;
136 else if ((s[0] != 0) && !(unum = getuser(s, &user)))
137 ret = 2;
138 else {
139 if (s[0] == 0)
140 user = getCurrentUser();
141 if (user) {
142 if (ismd5) {
143 ismd5 = !(memcmp(pw, user->md5passwd, MD5PASSLEN));
144 } else {
145 ismd5 = checkpasswd2(pw, user);
146 }
147 if (ismd5) {
148 ret = 0;
149 if (s[0] != 0)
150 setcurrentuser(user, unum);
151 } else {
152 ret = 1;
153 logattempt(user->userid, getSession()->fromhost, "www");
154 }
155 } else {
156 ret = 1;
157 }
158 }
159 RETURN_LONG(ret);
160 }

可以看出,这个函数与php密切相关,php zend会解析上层php页面调用变量,然后处理这些变量,而我们要做的,就是检查这些变量的合法性,然后将其传到checkpasswd2即可。

用户登陆的时候,首先会使用js检查输入信息合法性,然后转到bbslogin.php这个页面。我们可以发现有这么一句:

2 require("www2-funcs.php");

也就是说这个页面需要加载www2-funcs.php,那么我们再看看www2-funcs.php,发现


11 if (BUILD_PHP_EXTENSION==0)
12 @dl("$topdir/../libexec/bbs/libphpbbslib.so");

其实就是这句话,php使用了dl调用了我们编写的php扩展libphpbbslib.so,这个类似于C#中的dllimport调用COM一样。

好,我们回到bbslogin.php,加载之后,即可使用libphpbbslib.so的函数了。

24 if (($id!="guest")&&bbs_checkpasswd($id,$passwd)!=0) error_alert("用户密码错误,请重新登录!");

OK,就是这样的,php页面调用bbs_checkpasswd,然后得到返回值,就可以判断用户密码了。