Clean up for stability patch submitted previously

While continuing to run our application with the stability patch I submitted earlier, I discovered additional failure modes for some of our hardware switches were causing unexpected exceptions.

This revision better handles these situations.

Signed-off-by: Victor J. Orlikowski <vjo@duke.edu>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
This commit is contained in:
Victor Orlikowski 2015-12-25 05:42:01 +00:00 committed by FUJITA Tomonori
parent c085c0d40e
commit 46f4ced165

View File

@ -30,7 +30,7 @@ from ryu.lib.hub import StreamServer
import traceback
import random
import ssl
from socket import IPPROTO_TCP, TCP_NODELAY
from socket import IPPROTO_TCP, TCP_NODELAY, timeout as SocketTimeout, error as SocketError
import warnings
import ryu.base.app_manager
@ -172,12 +172,11 @@ class Datapath(ofproto_protocol.ProtocolDesc):
try:
ret = self.socket.recv(required_len)
except:
# Hit socket timeout; decide what to do.
if self.close_requested:
pass
else:
except SocketTimeout:
if not self.close_requested:
continue
except SocketError:
self.close_requested = True
if (len(ret) == 0) or (self.close_requested):
self.socket.close()