|
Home > Archive > Apache Directory Project > October 2005 > [mina] Traffic control patch proposal
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
[mina] Traffic control patch proposal
|
|
| Niklas Therning 2005-10-20, 5:45 pm |
| Hi again,
I've gone ahead with implementing suspend/read for nio transport. Please
see the attached diff for my proposal on how traffic control could be
implemented. This is just a patch for SocketIoProcessor which adds the
ability to apply a mask to the interestOps of a SocketSessionImpl.
Beware, I haven't tested it at all yet, it's only a proposal and maybe
it doesn't work at all. I would like to have your feedback. Maybe you
have a better idea for how to implement this? There might also be some
fundamental things in mina which I havent understood correctly. Please
let me know.
One thing I'm not sure of is what happens to the readyOps if you change
the interestOps during the same select-iteration? Will isReadable be
false if I first mask out OP_READ in the interestOps right before
processSessions() is called? If this isn't the case I guess my patch
won't work without some changes.
BTW, is this the preferred way of submitting patches or should I somehow
attach it to the JIRA issue instead?
Regards,
Niklas Therning
| |
| Niklas Therning 2005-10-20, 5:45 pm |
| Niklas Therning wrote:
>...
>
>One thing I'm not sure of is what happens to the readyOps if you change
>the interestOps during the same select-iteration? Will isReadable be
>false if I first mask out OP_READ in the interestOps right before
>processSessions() is called? If this isn't the case I guess my patch
>won't work without some changes.
>
>
>
The following additional change to SocketIoProcessor would be required
if interestOps doesn't change readyOps:
@@ -233,12 +286,13 @@
SelectionKey key = ( SelectionKey ) it.next();
SocketSessionImpl session = ( SocketSessionImpl )
key.attachment();
- if( key.isReadable() )
+ int mask = session.getInterestOpsMask();
+ if( (mask & SelectionKey.OP_READ) > 0 && key.isReadable() )
{
read( session );
}
- if( key.isWritable() )
+ if( (mask & SelectionKey.OP_WRITE) > 0 && key.isWritable() )
{
scheduleFlush( session );
}
WDYT?
Regards,
Niklas Therning
| |
| Trustin Lee 2005-10-20, 5:45 pm |
| Hi Niklas!
I'm sorry for this late reply first of all. I'm very busy preparing
ApacheCon PPT slides now. I'll get back to you soon after I'm done with this
painful slideworks.
And I forgot to mention thank you a lot! I'll definitely review it.
Thanks,
Trustin
2005/10/20, Niklas Therning <niklas-8FIgwK2HfyIwFerOooGFRg@public.gmane.org>:
>
> Hi again,
>
> I've gone ahead with implementing suspend/read for nio transport. Please
> see the attached diff for my proposal on how traffic control could be
> implemented. This is just a patch for SocketIoProcessor which adds the
> ability to apply a mask to the interestOps of a SocketSessionImpl.
>
> Beware, I haven't tested it at all yet, it's only a proposal and maybe
> it doesn't work at all. I would like to have your feedback. Maybe you
> have a better idea for how to implement this? There might also be some
> fundamental things in mina which I havent understood correctly. Please
> let me know.
>
> One thing I'm not sure of is what happens to the readyOps if you change
> the interestOps during the same select-iteration? Will isReadable be
> false if I first mask out OP_READ in the interestOps right before
> processSessions() is called? If this isn't the case I guess my patch
> won't work without some changes.
>
> BTW, is this the preferred way of submitting patches or should I somehow
> attach it to the JIRA issue instead?
>
> Regards,
> Niklas Therning
>
>
>
>
--
what we call human nature is actually human habit
--
http://gleamynode.net/
|
|
|
|
|