Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

正常写情况下,判断IsComplete和CloseBlock的时机有问题 #182

Closed
yvxiang opened this issue Feb 3, 2016 · 6 comments
Closed

Comments

@yvxiang
Copy link
Collaborator

yvxiang commented Feb 3, 2016

LocalWriteBlock里,会先调用Block::Write()将数据包放入sliding window,然后调用IsComplete判断是不是所有数据包已经都从sliding window中取出,如果是,将会调用CloseBlock将文件描述符关闭,同步元信息。而实际上,IsComplete并不一定会在对某一个数据包执行LocalWriteBlock时成立。

@bluebore
Copy link
Collaborator

bluebore commented Feb 3, 2016

你是觉得当前有问题还是 @lylei 的pr #181 有问题啊

@yvxiang
Copy link
Collaborator Author

yvxiang commented Feb 3, 2016

当前有问题

@bluebore
Copy link
Collaborator

bluebore commented Feb 3, 2016

最后一个LocalWriteBlock时肯定成立啊,因为最后一个肯定会触发slidingwindow的Notify,然后检查IsComplete

@yvxiang
Copy link
Collaborator Author

yvxiang commented Feb 3, 2016

slidingwindow的Notify是按包的顺序来的,如果最后一个包之前的几个包卡了呢?

@lylei
Copy link
Collaborator

lylei commented Feb 3, 2016

滑动窗口是乱序进顺序出的,时间上最后一个调用Notify的并不一定是文件顺序上的最后一个,但是这时候文件顺序上的最后一个包肯定已经到了。。不知道说明白了没。。确实有点绕==

@yvxiang
Copy link
Collaborator Author

yvxiang commented Feb 3, 2016

想通了。从LocalWriteBlock到SlidingWindow::Add到Notify再到Block::Append这一条链中没有异步调用,这样就没问题了。
我的错。。。

@yvxiang yvxiang closed this as completed Feb 3, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants