On Wed, Jun 12, 2013 at 07:44:01PM +0900, YAMAMOTO Takashi wrote:
> 
> Signed-off-by: YAMAMOTO Takashi <[email protected]>
> ---
>  ryu/controller/controller.py | 11 ++++++++---
>  1 file changed, 8 insertions(+), 3 deletions(-)
> 
> diff --git a/ryu/controller/controller.py b/ryu/controller/controller.py
> index 66d50a3..60943b7 100644
> --- a/ryu/controller/controller.py
> +++ b/ryu/controller/controller.py
> @@ -22,6 +22,7 @@ from ryu.lib.hub import StreamServer
>  import traceback
>  import random
>  import ssl
> +import sys
>  
>  import ryu.base.app_manager
>  
> @@ -311,10 +312,14 @@ def datapath_connection_factory(socket, address):
>          try:
>              datapath.serve()
>          except:
> +            exc_info = sys.exc_info()
>              # Something went wrong.
>              # Especially malicious switch can send malformed packet,
>              # the parser raise exception.
>              # Can we do anything more graceful?
> -            LOG.error("Error in the datapath %s from %s",
> -                      dpid_to_str(datapath.id), address)
> -            raise
> +            try:
> +                dpid_str = dpid_to_str(datapath.id)
> +            except:
> +                dpid_str = "%s" % datapath.id
> +            LOG.error("Error in the datapath %s from %s", dpid_str, address)
> +            raise exc_info[0], exc_info[1], exc_info[2]

The case is datapath.id == None?
If so, instead of saving exc and catching exc,
how about

    if datapath.id is None:
        dpid_str = "%s" % datapath.id
    else
        dpid_str = dpid_to_str(datapath.id)

thanks,


> -- 
> 1.8.1.5
> 
> 
> ------------------------------------------------------------------------------
> This SF.net email is sponsored by Windows:
> 
> Build for Windows Store.
> 
> http://p.sf.net/sfu/windows-dev2dev
> _______________________________________________
> Ryu-devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/ryu-devel
> 

-- 
yamahata

------------------------------------------------------------------------------
This SF.net email is sponsored by Windows:

Build for Windows Store.

http://p.sf.net/sfu/windows-dev2dev
_______________________________________________
Ryu-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ryu-devel

Reply via email to