You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@mina.apache.org by "Lyor Goldstein (Jira)" <ji...@apache.org> on 2020/09/17 09:09:00 UTC

[jira] [Commented] (SSHD-1080) Revisit the PacketWriter interface

    [ https://issues.apache.org/jira/browse/SSHD-1080?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17197536#comment-17197536 ] 

Lyor Goldstein commented on SSHD-1080:
--------------------------------------

{quote}The expectations when using Session.writePacket, Channel.writePacket and IoOutputStream.writePacket are different, so I don't think it's a good idea to use a single interface for those.
{quote}
Agreed - but if the API is the same I don't think we should duplicate the code. Perhaps the following will do:
{code:java}
interface PacketWriter {
     // the basic one
    IoWriteFuture writePacket(Buffer buffer) throws IOException;
}

interface SessionPacketWriter extends PacketWriter, SessionHolder<Session> {
   ...extra specific methods...
}

interface ChannelPacketWriter extends PacketWriter, ChannelHolder<Channel> {
 ...extra specific methods... 
}

interface IoOutputStreamPacketWriter extends PacketWriter {
 ...extra specific methods... 
}
{code}
The idea is that were the distinction is not important we would use {{PacketWriter}} and where it is we will use the relevant concrete interface.

Just a suggestion...

> Revisit the PacketWriter interface
> ----------------------------------
>
>                 Key: SSHD-1080
>                 URL: https://issues.apache.org/jira/browse/SSHD-1080
>             Project: MINA SSHD
>          Issue Type: Improvement
>            Reporter: Guillaume Nodet
>            Priority: Major
>
> The expectations when using {{Session.writePacket}}, {{Channel.writePacket}} and {{IoOutputStream.writePacket}} are different, so I don't think it's a good idea to use a single interface for those.
> The only real place where it's used is in the {{ThrottlingPacketWriter}} which would need to be reworked.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@mina.apache.org
For additional commands, e-mail: dev-help@mina.apache.org