Skip to content

Commit

Permalink
Expose EventLoop on Stream
Browse files Browse the repository at this point in the history
  • Loading branch information
ianopolous committed May 26, 2023
1 parent 647afe3 commit ec080fe
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import io.libp2p.tools.p2pd.libp2pj.Muxer;
import io.libp2p.tools.p2pd.libp2pj.Stream;
import io.netty.buffer.Unpooled;
import io.netty.channel.Channel;
import io.netty.channel.*;

import java.nio.ByteBuffer;

Expand All @@ -30,6 +30,11 @@ public NettyStream(Channel channel, boolean initiator) {
this(channel, initiator, null, null);
}

@Override
public EventLoop eventLoop() {
return channel.eventLoop();
}

@Override
public void write(ByteBuffer data) {
channel.write(Unpooled.wrappedBuffer(data));
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package io.libp2p.tools.p2pd.libp2pj;

import io.netty.channel.*;

import java.nio.ByteBuffer;

/**
Expand All @@ -9,6 +11,8 @@ public interface Stream<TEndpoint> {

boolean isInitiator();

EventLoop eventLoop();

void write(ByteBuffer data);

void flush();
Expand Down

0 comments on commit ec080fe

Please sign in to comment.