You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@mina.apache.org by "Mark Webb (JIRA)" <ji...@apache.org> on 2007/06/23 13:58:25 UTC

[jira] Created: (DIRMINA-389) Create a Connection Throttle Filter

Create a Connection Throttle Filter
-----------------------------------

                 Key: DIRMINA-389
                 URL: https://issues.apache.org/jira/browse/DIRMINA-389
             Project: MINA
          Issue Type: New Feature
          Components: Filter
    Affects Versions: 2.0.0-M1
         Environment: All
            Reporter: Mark Webb
            Assignee: Mark Webb
            Priority: Minor
             Fix For: 2.0.0-M1


Create a filter that will throttle connections.  This filter will monitor newly created sessions and if new connections from the same IP address come in too fast, drop the connections.  

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Re: [jira] Commented: (DIRMINA-389) Create a Connection Throttle Filter

Posted by peter royal <pr...@apache.org>.
On Jun 23, 2007, at 11:02 AM, Mark Webb wrote:
> Not a problem.  I will take this one and make the change.  I think  
> I was
> overly-influenced by the ConcurrentHashMap discussions :)

heh, yup.. just totally different access patterns on this one :)  
looks great otherwise!

-pete


-- 
proyal@apache.org - http://fotap.org/~osi




Re: [jira] Commented: (DIRMINA-389) Create a Connection Throttle Filter

Posted by Mark Webb <el...@gmail.com>.
Not a problem.  I will take this one and make the change.  I think I was
overly-influenced by the ConcurrentHashMap discussions :)

On 6/23/07, peter royal (JIRA) <ji...@apache.org> wrote:
>
>
>     [
> https://issues.apache.org/jira/browse/DIRMINA-389?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12507621]
>
> peter royal commented on DIRMINA-389:
> -------------------------------------
>
> Cool! A definite case where the ConcurrentHashMap would help though..
> It'll allow concurrent modifications, whereas the Synchronized map will
> become a choke point of its own when a bunch of connection requests come in
> :)
>
> > Create a Connection Throttle Filter
> > -----------------------------------
> >
> >                 Key: DIRMINA-389
> >                 URL: https://issues.apache.org/jira/browse/DIRMINA-389
> >             Project: MINA
> >          Issue Type: New Feature
> >          Components: Filter
> >    Affects Versions: 2.0.0-M1
> >         Environment: All
> >            Reporter: Mark Webb
> >            Assignee: Mark Webb
> >            Priority: Minor
> >             Fix For: 2.0.0-M1
> >
> >
> > Create a filter that will throttle connections.  This filter will
> monitor newly created sessions and if new connections from the same IP
> address come in too fast, drop the connections.
>
> --
> This message is automatically generated by JIRA.
> -
> You can reply to this email to add a comment to the issue online.
>
>


-- 
..Cheers
Mark

Re: [jira] Work started: (DIRMINA-389) Create a Connection Throttle Filter

Posted by Mark Webb <el...@gmail.com>.
I just updated the code to hopefully make things more clear.  What I now do
is perform a lookup in the map for the IP address, if the IP address exists,
then I test get the value from the map with the key being the IP address.
The value from the map is the last connected time.  This time and the
current time are subtracted and if the result is less than the interval
time, then the session will be closed.  On each call to this method, I
updated the map with the current time.  This will ensure that the last
connected time from a specified IP address will get updated per connection
attempt.

I hope this clears things up.
Mark

On 6/23/07, liquidchen <li...@gmail.com> wrote:
>
>
>
>   it's greate to have this filter, but seems only the session first
> connect
> will be succ, others will all fail
>
> JIRA jira@apache.org wrote:
> >
> >
> >      [
> >
> https://issues.apache.org/jira/browse/DIRMINA-389?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
> > ]
> >
> > Work on DIRMINA-389 started by Mark Webb.
> >
> >> Create a Connection Throttle Filter
> >> -----------------------------------
> >>
> >>                 Key: DIRMINA-389
> >>                 URL: https://issues.apache.org/jira/browse/DIRMINA-389
> >>             Project: MINA
> >>          Issue Type: New Feature
> >>          Components: Filter
> >>    Affects Versions: 2.0.0-M1
> >>         Environment: All
> >>            Reporter: Mark Webb
> >>            Assignee: Mark Webb
> >>            Priority: Minor
> >>             Fix For: 2.0.0-M1
> >>
> >>
> >> Create a filter that will throttle connections.  This filter will
> monitor
> >> newly created sessions and if new connections from the same IP address
> >> come in too fast, drop the connections.
> >
> > --
> > This message is automatically generated by JIRA.
> > -
> > You can reply to this email to add a comment to the issue online.
> >
> >
> >
>
> --
> View this message in context:
> http://www.nabble.com/-jira--Created%3A-%28DIRMINA-389%29-Create-a-Connection-Throttle-Filter-tf3968930.html#a11272049
> Sent from the mina dev mailing list archive at Nabble.com.
>
>


-- 
..Cheers
Mark

Re: [jira] Work started: (DIRMINA-389) Create a Connection Throttle Filter

Posted by liquidchen <li...@gmail.com>.

  it's greate to have this filter, but seems only the session first connect
will be succ, others will all fail 

JIRA jira@apache.org wrote:
> 
> 
>      [
> https://issues.apache.org/jira/browse/DIRMINA-389?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
> ]
> 
> Work on DIRMINA-389 started by Mark Webb.
> 
>> Create a Connection Throttle Filter
>> -----------------------------------
>>
>>                 Key: DIRMINA-389
>>                 URL: https://issues.apache.org/jira/browse/DIRMINA-389
>>             Project: MINA
>>          Issue Type: New Feature
>>          Components: Filter
>>    Affects Versions: 2.0.0-M1
>>         Environment: All
>>            Reporter: Mark Webb
>>            Assignee: Mark Webb
>>            Priority: Minor
>>             Fix For: 2.0.0-M1
>>
>>
>> Create a filter that will throttle connections.  This filter will monitor
>> newly created sessions and if new connections from the same IP address
>> come in too fast, drop the connections.  
> 
> -- 
> This message is automatically generated by JIRA.
> -
> You can reply to this email to add a comment to the issue online.
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/-jira--Created%3A-%28DIRMINA-389%29-Create-a-Connection-Throttle-Filter-tf3968930.html#a11272049
Sent from the mina dev mailing list archive at Nabble.com.


Re: [jira] Updated: (DIRMINA-389) Create a Connection Throttle Filter

Posted by Mark <el...@gmail.com>.
sure, not a problem.  I was just confused as to what you meant.  Maybe
cuz I just crawled out of bed :)

On 10/23/07, Trustin Lee <tr...@gmail.com> wrote:
> Hmm?  I thought the introduction of ConnectionThrottleFilter will not
> affect the core API at all, because it's just a filter.  So I removed
> Fix Versions field to reduce the number of issues to resolve in
> 2.0.0-M1, because many people are waiting the first milestone of 2.0.
> Of course we will improve ConnectionThrottleFilter  in 2.0.0-M2 or M3
> probably.  Does it make sense?
>
> Trustin
>
> On 10/23/07, Mark <el...@gmail.com> wrote:
> > Trustin,
> >
> > Not sure I understand your latest comment on this issue.
> >
> > On 10/22/07, Trustin Lee (JIRA) <ji...@apache.org> wrote:
> > >
> > >      [ https://issues.apache.org/jira/browse/DIRMINA-389?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
> > >
> > > Trustin Lee updated DIRMINA-389:
> > > --------------------------------
> > >
> > >     Affects Version/s:     (was: 2.0.0-M1)
> > >         Fix Version/s:     (was: 2.0.0-M1)
> > >
> > > We don't need any core API modification.  Therefore, we can implement this feature later, but at least before 2.0.0-RC1.
> > >
> > > > Create a Connection Throttle Filter
> > > > -----------------------------------
> > > >
> > > >                 Key: DIRMINA-389
> > > >                 URL: https://issues.apache.org/jira/browse/DIRMINA-389
> > > >             Project: MINA
> > > >          Issue Type: New Feature
> > > >          Components: Filter
> > > >         Environment: All
> > > >            Reporter: Mark Webb
> > > >            Assignee: Mark Webb
> > > >            Priority: Minor
> > > >
> > > > Create a filter that will throttle connections.  This filter will monitor newly created sessions and if new connections from the same IP address come in too fast, drop the connections.
> > >
> > > --
> > > This message is automatically generated by JIRA.
> > > -
> > > You can reply to this email to add a comment to the issue online.
> > >
> > >
> >
> >
> > --
> > --------------------------------
> > The adjuration to be "normal" seems shockingly repellent to me; I see
> > neither hope nor comfort in sinking to that low level. I think it is
> > ignorance that makes people think of abnormality only with horror and
> > allows them to remain undismayed at the proximity of "normal" to
> > average and mediocre. For surely anyone who achieves anything is,
> > essentially, abnormal.
> >      Dr. Karl Menninger
> >
>
>
> --
> what we call human nature is actually human habit
> --
> http://gleamynode.net/
> --
> PGP Key ID: 0x0255ECA6
>


-- 
--------------------------------
The adjuration to be "normal" seems shockingly repellent to me; I see
neither hope nor comfort in sinking to that low level. I think it is
ignorance that makes people think of abnormality only with horror and
allows them to remain undismayed at the proximity of "normal" to
average and mediocre. For surely anyone who achieves anything is,
essentially, abnormal.
     Dr. Karl Menninger

Re: [jira] Updated: (DIRMINA-389) Create a Connection Throttle Filter

Posted by Trustin Lee <tr...@gmail.com>.
Hmm?  I thought the introduction of ConnectionThrottleFilter will not
affect the core API at all, because it's just a filter.  So I removed
Fix Versions field to reduce the number of issues to resolve in
2.0.0-M1, because many people are waiting the first milestone of 2.0.
Of course we will improve ConnectionThrottleFilter  in 2.0.0-M2 or M3
probably.  Does it make sense?

Trustin

On 10/23/07, Mark <el...@gmail.com> wrote:
> Trustin,
>
> Not sure I understand your latest comment on this issue.
>
> On 10/22/07, Trustin Lee (JIRA) <ji...@apache.org> wrote:
> >
> >      [ https://issues.apache.org/jira/browse/DIRMINA-389?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
> >
> > Trustin Lee updated DIRMINA-389:
> > --------------------------------
> >
> >     Affects Version/s:     (was: 2.0.0-M1)
> >         Fix Version/s:     (was: 2.0.0-M1)
> >
> > We don't need any core API modification.  Therefore, we can implement this feature later, but at least before 2.0.0-RC1.
> >
> > > Create a Connection Throttle Filter
> > > -----------------------------------
> > >
> > >                 Key: DIRMINA-389
> > >                 URL: https://issues.apache.org/jira/browse/DIRMINA-389
> > >             Project: MINA
> > >          Issue Type: New Feature
> > >          Components: Filter
> > >         Environment: All
> > >            Reporter: Mark Webb
> > >            Assignee: Mark Webb
> > >            Priority: Minor
> > >
> > > Create a filter that will throttle connections.  This filter will monitor newly created sessions and if new connections from the same IP address come in too fast, drop the connections.
> >
> > --
> > This message is automatically generated by JIRA.
> > -
> > You can reply to this email to add a comment to the issue online.
> >
> >
>
>
> --
> --------------------------------
> The adjuration to be "normal" seems shockingly repellent to me; I see
> neither hope nor comfort in sinking to that low level. I think it is
> ignorance that makes people think of abnormality only with horror and
> allows them to remain undismayed at the proximity of "normal" to
> average and mediocre. For surely anyone who achieves anything is,
> essentially, abnormal.
>      Dr. Karl Menninger
>


-- 
what we call human nature is actually human habit
--
http://gleamynode.net/
--
PGP Key ID: 0x0255ECA6

Re: [jira] Updated: (DIRMINA-389) Create a Connection Throttle Filter

Posted by Mark <el...@gmail.com>.
Trustin,

Not sure I understand your latest comment on this issue.

On 10/22/07, Trustin Lee (JIRA) <ji...@apache.org> wrote:
>
>      [ https://issues.apache.org/jira/browse/DIRMINA-389?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
>
> Trustin Lee updated DIRMINA-389:
> --------------------------------
>
>     Affects Version/s:     (was: 2.0.0-M1)
>         Fix Version/s:     (was: 2.0.0-M1)
>
> We don't need any core API modification.  Therefore, we can implement this feature later, but at least before 2.0.0-RC1.
>
> > Create a Connection Throttle Filter
> > -----------------------------------
> >
> >                 Key: DIRMINA-389
> >                 URL: https://issues.apache.org/jira/browse/DIRMINA-389
> >             Project: MINA
> >          Issue Type: New Feature
> >          Components: Filter
> >         Environment: All
> >            Reporter: Mark Webb
> >            Assignee: Mark Webb
> >            Priority: Minor
> >
> > Create a filter that will throttle connections.  This filter will monitor newly created sessions and if new connections from the same IP address come in too fast, drop the connections.
>
> --
> This message is automatically generated by JIRA.
> -
> You can reply to this email to add a comment to the issue online.
>
>


-- 
--------------------------------
The adjuration to be "normal" seems shockingly repellent to me; I see
neither hope nor comfort in sinking to that low level. I think it is
ignorance that makes people think of abnormality only with horror and
allows them to remain undismayed at the proximity of "normal" to
average and mediocre. For surely anyone who achieves anything is,
essentially, abnormal.
     Dr. Karl Menninger

[jira] Commented: (DIRMINA-389) Create a Connection Throttle Filter

Posted by "Mark Webb (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DIRMINA-389?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12507755 ] 

Mark Webb commented on DIRMINA-389:
-----------------------------------

After performing some more tests, I think I now disagree.  I have created a
test case where I make 2 nearly simultaneous connections to a server using
the ConnectionThrottleFilter and they both pass.  Seeing that this is our
worst case scenario (malicious client blasting the server), I think we may
need to either:

1. speed up the logic in the filter to prevent thread interleavnig
2. use a synchronized map

I vote for #2 to be safe.  In order to support this change, I have made the
clients Map in ConnectionThrottleFilter a synchronized Map using the
Collections class and things work better in my test code.  I can post the
test code if you are interested.





-- 
..Cheers
Mark


> Create a Connection Throttle Filter
> -----------------------------------
>
>                 Key: DIRMINA-389
>                 URL: https://issues.apache.org/jira/browse/DIRMINA-389
>             Project: MINA
>          Issue Type: New Feature
>          Components: Filter
>    Affects Versions: 2.0.0-M1
>         Environment: All
>            Reporter: Mark Webb
>            Assignee: Mark Webb
>            Priority: Minor
>             Fix For: 2.0.0-M1
>
>
> Create a filter that will throttle connections.  This filter will monitor newly created sessions and if new connections from the same IP address come in too fast, drop the connections.  

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Resolved: (DIRMINA-389) Create a Connection Throttle Filter

Posted by "Mark Webb (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DIRMINA-389?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Mark Webb resolved DIRMINA-389.
-------------------------------

    Resolution: Fixed

Checked in the code.

org.apache.mina.filter.ConnectionThrottleFilter



> Create a Connection Throttle Filter
> -----------------------------------
>
>                 Key: DIRMINA-389
>                 URL: https://issues.apache.org/jira/browse/DIRMINA-389
>             Project: MINA
>          Issue Type: New Feature
>          Components: Filter
>    Affects Versions: 2.0.0-M1
>         Environment: All
>            Reporter: Mark Webb
>            Assignee: Mark Webb
>            Priority: Minor
>             Fix For: 2.0.0-M1
>
>
> Create a filter that will throttle connections.  This filter will monitor newly created sessions and if new connections from the same IP address come in too fast, drop the connections.  

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (DIRMINA-389) Create a Connection Throttle Filter

Posted by "Trustin Lee (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DIRMINA-389?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12534789 ] 

Trustin Lee commented on DIRMINA-389:
-------------------------------------

What would happen when two clients connect within the same nanosecs?  :)  Whatever time unit we use, we need an additional counter.

> Create a Connection Throttle Filter
> -----------------------------------
>
>                 Key: DIRMINA-389
>                 URL: https://issues.apache.org/jira/browse/DIRMINA-389
>             Project: MINA
>          Issue Type: New Feature
>          Components: Filter
>    Affects Versions: 2.0.0-M1
>         Environment: All
>            Reporter: Mark Webb
>            Assignee: Mark Webb
>            Priority: Minor
>             Fix For: 2.0.0-M1
>
>
> Create a filter that will throttle connections.  This filter will monitor newly created sessions and if new connections from the same IP address come in too fast, drop the connections.  

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (DIRMINA-389) Create a Connection Throttle Filter

Posted by "Trustin Lee (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DIRMINA-389?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12532599 ] 

Trustin Lee commented on DIRMINA-389:
-------------------------------------

We also need to provide a property that limits the number of the clients from the same host.

For now we have a problem with more than one client that connects within the same milliseconds because we are using System.currentTimeMillis().  Adding additional counter will fix it.  Therefore, we need some simple bookeeping data structure here.

> Create a Connection Throttle Filter
> -----------------------------------
>
>                 Key: DIRMINA-389
>                 URL: https://issues.apache.org/jira/browse/DIRMINA-389
>             Project: MINA
>          Issue Type: New Feature
>          Components: Filter
>    Affects Versions: 2.0.0-M1
>         Environment: All
>            Reporter: Mark Webb
>            Assignee: Mark Webb
>            Priority: Minor
>             Fix For: 2.0.0-M1
>
>
> Create a filter that will throttle connections.  This filter will monitor newly created sessions and if new connections from the same IP address come in too fast, drop the connections.  

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Closed: (DIRMINA-389) Create a Connection Throttle Filter

Posted by "Mark Webb (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DIRMINA-389?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Mark Webb closed DIRMINA-389.
-----------------------------


Code has been checked in.

> Create a Connection Throttle Filter
> -----------------------------------
>
>                 Key: DIRMINA-389
>                 URL: https://issues.apache.org/jira/browse/DIRMINA-389
>             Project: MINA
>          Issue Type: New Feature
>          Components: Filter
>    Affects Versions: 2.0.0-M1
>         Environment: All
>            Reporter: Mark Webb
>            Assignee: Mark Webb
>            Priority: Minor
>             Fix For: 2.0.0-M1
>
>
> Create a filter that will throttle connections.  This filter will monitor newly created sessions and if new connections from the same IP address come in too fast, drop the connections.  

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (DIRMINA-389) Create a Connection Throttle Filter

Posted by "peter royal (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DIRMINA-389?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12507621 ] 

peter royal commented on DIRMINA-389:
-------------------------------------

Cool! A definite case where the ConcurrentHashMap would help though.. It'll allow concurrent modifications, whereas the Synchronized map will become a choke point of its own when a bunch of connection requests come in :)

> Create a Connection Throttle Filter
> -----------------------------------
>
>                 Key: DIRMINA-389
>                 URL: https://issues.apache.org/jira/browse/DIRMINA-389
>             Project: MINA
>          Issue Type: New Feature
>          Components: Filter
>    Affects Versions: 2.0.0-M1
>         Environment: All
>            Reporter: Mark Webb
>            Assignee: Mark Webb
>            Priority: Minor
>             Fix For: 2.0.0-M1
>
>
> Create a filter that will throttle connections.  This filter will monitor newly created sessions and if new connections from the same IP address come in too fast, drop the connections.  

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (DIRMINA-389) Create a Connection Throttle Filter

Posted by "Mark Webb (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DIRMINA-389?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12576032#action_12576032 ] 

Mark Webb commented on DIRMINA-389:
-----------------------------------

Maybe this could be solved using an ExpiringHashMap.  The expiration time would be the length of time that a host cannot have more than one connection.

> Create a Connection Throttle Filter
> -----------------------------------
>
>                 Key: DIRMINA-389
>                 URL: https://issues.apache.org/jira/browse/DIRMINA-389
>             Project: MINA
>          Issue Type: New Feature
>          Components: Filter
>         Environment: All
>            Reporter: Mark Webb
>            Assignee: Mark Webb
>            Priority: Minor
>
> Create a filter that will throttle connections.  This filter will monitor newly created sessions and if new connections from the same IP address come in too fast, drop the connections.  

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (DIRMINA-389) Create a Connection Throttle Filter

Posted by "Mark Webb (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DIRMINA-389?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12533570 ] 

Mark Webb commented on DIRMINA-389:
-----------------------------------

Couldn't we just change the call to System.currentTimeMillis() to System.nanoTime()

http://java.sun.com/javase/6/docs/api/java/lang/System.html#nanoTime()

> Create a Connection Throttle Filter
> -----------------------------------
>
>                 Key: DIRMINA-389
>                 URL: https://issues.apache.org/jira/browse/DIRMINA-389
>             Project: MINA
>          Issue Type: New Feature
>          Components: Filter
>    Affects Versions: 2.0.0-M1
>         Environment: All
>            Reporter: Mark Webb
>            Assignee: Mark Webb
>            Priority: Minor
>             Fix For: 2.0.0-M1
>
>
> Create a filter that will throttle connections.  This filter will monitor newly created sessions and if new connections from the same IP address come in too fast, drop the connections.  

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (DIRMINA-389) Create a Connection Throttle Filter

Posted by "Trustin Lee (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DIRMINA-389?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Trustin Lee updated DIRMINA-389:
--------------------------------

    Affects Version/s:     (was: 2.0.0-M1)
        Fix Version/s:     (was: 2.0.0-M1)

We don't need any core API modification.  Therefore, we can implement this feature later, but at least before 2.0.0-RC1.

> Create a Connection Throttle Filter
> -----------------------------------
>
>                 Key: DIRMINA-389
>                 URL: https://issues.apache.org/jira/browse/DIRMINA-389
>             Project: MINA
>          Issue Type: New Feature
>          Components: Filter
>         Environment: All
>            Reporter: Mark Webb
>            Assignee: Mark Webb
>            Priority: Minor
>
> Create a filter that will throttle connections.  This filter will monitor newly created sessions and if new connections from the same IP address come in too fast, drop the connections.  

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Work started: (DIRMINA-389) Create a Connection Throttle Filter

Posted by "Mark Webb (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DIRMINA-389?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Work on DIRMINA-389 started by Mark Webb.

> Create a Connection Throttle Filter
> -----------------------------------
>
>                 Key: DIRMINA-389
>                 URL: https://issues.apache.org/jira/browse/DIRMINA-389
>             Project: MINA
>          Issue Type: New Feature
>          Components: Filter
>    Affects Versions: 2.0.0-M1
>         Environment: All
>            Reporter: Mark Webb
>            Assignee: Mark Webb
>            Priority: Minor
>             Fix For: 2.0.0-M1
>
>
> Create a filter that will throttle connections.  This filter will monitor newly created sessions and if new connections from the same IP address come in too fast, drop the connections.  

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (DIRMINA-389) Create a Connection Throttle Filter

Posted by "Emmanuel Lecharny (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DIRMINA-389?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Emmanuel Lecharny updated DIRMINA-389:
--------------------------------------

    Fix Version/s: 3.0.0-M1

> Create a Connection Throttle Filter
> -----------------------------------
>
>                 Key: DIRMINA-389
>                 URL: https://issues.apache.org/jira/browse/DIRMINA-389
>             Project: MINA
>          Issue Type: New Feature
>          Components: Filter
>         Environment: All
>            Reporter: Mark Webb
>            Assignee: Mark Webb
>            Priority: Minor
>             Fix For: 3.0.0-M1
>
>
> Create a filter that will throttle connections.  This filter will monitor newly created sessions and if new connections from the same IP address come in too fast, drop the connections.  

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (DIRMINA-389) Create a Connection Throttle Filter

Posted by "Mark Webb (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DIRMINA-389?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12511157 ] 

Mark Webb commented on DIRMINA-389:
-----------------------------------

Although I have checked in the code using a synchronized Map, I would like to keep this issue open until I can find an alternative.

> Create a Connection Throttle Filter
> -----------------------------------
>
>                 Key: DIRMINA-389
>                 URL: https://issues.apache.org/jira/browse/DIRMINA-389
>             Project: MINA
>          Issue Type: New Feature
>          Components: Filter
>    Affects Versions: 2.0.0-M1
>         Environment: All
>            Reporter: Mark Webb
>            Assignee: Mark Webb
>            Priority: Minor
>             Fix For: 2.0.0-M1
>
>
> Create a filter that will throttle connections.  This filter will monitor newly created sessions and if new connections from the same IP address come in too fast, drop the connections.  

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Reopened: (DIRMINA-389) Create a Connection Throttle Filter

Posted by "Mark Webb (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DIRMINA-389?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Mark Webb reopened DIRMINA-389:
-------------------------------


----- SERVER CODE -----
public class ConnFilterServer extends IoHandlerAdapter {

	protected static final int PORT = 5678;
	
	public ConnFilterServer() throws IOException{
		IoAcceptor acceptor = new SocketAcceptor();
		ConnectionThrottleFilter ctFilter = new ConnectionThrottleFilter();
		acceptor.getFilterChain().addLast("ConnThrottle", ctFilter);
		acceptor.setHandler( this );
		acceptor.setLocalAddress( new InetSocketAddress(PORT));
		acceptor.bind();
		System.out.println("Connection Filter Server running...");
	}

	public void sessionClosed(IoSession session) throws Exception {
		SessionLog.info( session, "The session has been closed" );
	}
	
	public static void main(String[] args) throws IOException {
		new ConnFilterServer();
	}
}
--- END SERVER CODE ----


---CLIENT CODE---
public class ConnFilterClient extends IoHandlerAdapter implements IoFutureListener {

	public ConnFilterClient(){
		makeConnection( "localhost", ConnFilterServer.PORT );
		makeConnection( "localhost", ConnFilterServer.PORT );
	}
	
	private void makeConnection( String host, int port){
		IoConnector connector = new SocketConnector();
		connector.setHandler( this );
		ConnectFuture connFuture = connector.connect( new InetSocketAddress(host,port));
		connFuture.addListener( this );
	}
	
	public void operationComplete(IoFuture future) {
		if( future instanceof ConnectFuture ){
			ConnectFuture connFuture = (ConnectFuture)future;
			if( connFuture.isConnected() ){
				System.out.println("Connected...");
				IoSession session = connFuture.getSession();
				session.write( ByteBuffer.wrap("Hello World".getBytes()) );
			}
		}
	}

	public static void main(String[] args) {
		new ConnFilterClient();
	}
}
--- END CLIENT CODE ---

> Create a Connection Throttle Filter
> -----------------------------------
>
>                 Key: DIRMINA-389
>                 URL: https://issues.apache.org/jira/browse/DIRMINA-389
>             Project: MINA
>          Issue Type: New Feature
>          Components: Filter
>    Affects Versions: 2.0.0-M1
>         Environment: All
>            Reporter: Mark Webb
>            Assignee: Mark Webb
>            Priority: Minor
>             Fix For: 2.0.0-M1
>
>
> Create a filter that will throttle connections.  This filter will monitor newly created sessions and if new connections from the same IP address come in too fast, drop the connections.  

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.