Skip to content
Snippets Groups Projects
Commit 42577fde authored by abat's avatar abat
Browse files

Merge into master from pull request #3085:

BSC-3484: Master not always handling EPERM error (https://github.com/bigswitch/bigswitchcontroller/pull/3085)
parents 10d63296 f66683e7
No related branches found
No related tags found
No related merge requests found
...@@ -31,6 +31,7 @@ import java.util.HashMap; ...@@ -31,6 +31,7 @@ import java.util.HashMap;
import java.util.HashSet; import java.util.HashSet;
import java.util.Iterator; import java.util.Iterator;
import java.util.LinkedHashMap; import java.util.LinkedHashMap;
import java.util.LinkedList;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Map.Entry; import java.util.Map.Entry;
...@@ -62,6 +63,7 @@ import net.floodlightcontroller.core.RoleInfo; ...@@ -62,6 +63,7 @@ import net.floodlightcontroller.core.RoleInfo;
import net.floodlightcontroller.core.annotations.LogMessageDoc; import net.floodlightcontroller.core.annotations.LogMessageDoc;
import net.floodlightcontroller.core.annotations.LogMessageDocs; import net.floodlightcontroller.core.annotations.LogMessageDocs;
import net.floodlightcontroller.core.internal.OFChannelState.HandshakeState; import net.floodlightcontroller.core.internal.OFChannelState.HandshakeState;
import net.floodlightcontroller.core.internal.RoleChanger.PendingRoleRequestEntry;
import net.floodlightcontroller.core.util.ListenerDispatcher; import net.floodlightcontroller.core.util.ListenerDispatcher;
import net.floodlightcontroller.core.util.SingletonTask; import net.floodlightcontroller.core.util.SingletonTask;
import net.floodlightcontroller.core.web.CoreWebRoutable; import net.floodlightcontroller.core.web.CoreWebRoutable;
...@@ -1017,7 +1019,9 @@ public class Controller implements IFloodlightProviderService, ...@@ -1017,7 +1019,9 @@ public class Controller implements IFloodlightProviderService,
// the master to someone else. // the master to someone else.
// Only send if there are no pending requests. // Only send if there are no pending requests.
synchronized(roleChanger) { synchronized(roleChanger) {
if (roleChanger.pendingRequestMap.get(sw) == null) { LinkedList<PendingRoleRequestEntry> list =
roleChanger.pendingRequestMap.get(sw);
if (list == null || list.isEmpty()) {
log.info("Tell switch {} who is the master", sw); log.info("Tell switch {} who is the master", sw);
roleChanger.submitRequest(Collections.singleton(sw), role); roleChanger.submitRequest(Collections.singleton(sw), role);
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment