mirror of
https://github.com/bitcoinj/bitcoinj.git
synced 2025-03-10 09:20:04 +01:00
Fix FakeChannelSink so events are put into the queue in the right order (BEFORE running event handlers, not after).
This commit is contained in:
parent
7bfef81664
commit
e20c35bf50
1 changed files with 7 additions and 8 deletions
|
@ -1,18 +1,19 @@
|
|||
package com.google.bitcoin.core;
|
||||
|
||||
import static org.jboss.netty.channel.Channels.fireChannelConnected;
|
||||
|
||||
import org.jboss.netty.channel.*;
|
||||
|
||||
import static org.jboss.netty.channel.Channels.fireChannelConnected;
|
||||
|
||||
public class FakeChannelSink extends AbstractChannelSink {
|
||||
|
||||
public void eventSunk(ChannelPipeline pipeline, ChannelEvent e)
|
||||
throws Exception {
|
||||
public void eventSunk(ChannelPipeline pipeline, ChannelEvent e) throws Exception {
|
||||
if (e instanceof ChannelStateEvent) {
|
||||
ChannelStateEvent event = (ChannelStateEvent) e;
|
||||
|
||||
FakeChannel channel =
|
||||
(FakeChannel) event.getChannel();
|
||||
FakeChannel channel = (FakeChannel) event.getChannel();
|
||||
boolean offered = channel.events.offer(event);
|
||||
assert offered;
|
||||
|
||||
ChannelFuture future = event.getFuture();
|
||||
ChannelState state = event.getState();
|
||||
Object value = event.getValue();
|
||||
|
@ -42,8 +43,6 @@ public class FakeChannelSink extends AbstractChannelSink {
|
|||
future.setSuccess();
|
||||
break;
|
||||
}
|
||||
boolean offered = channel.events.offer(event);
|
||||
assert offered;
|
||||
} else if (e instanceof MessageEvent) {
|
||||
MessageEvent event = (MessageEvent) e;
|
||||
FakeChannel channel = (FakeChannel) event.getChannel();
|
||||
|
|
Loading…
Add table
Reference in a new issue