Added locking to HypergridLinker, to prevent problems if multiple linking requests for the same region are handled simultaneously

0.8.2-post-fixes
Oren Hurvitz 2015-07-22 20:39:30 +03:00
parent 3e90d28d33
commit 43c8e2396e
1 changed files with 14 additions and 6 deletions

View File

@ -186,12 +186,12 @@ namespace OpenSim.Services.GridService
private static Random random = new Random(); private static Random random = new Random();
// From the command line link-region (obsolete) and the map // From the command line link-region (obsolete) and the map
public GridRegion TryLinkRegionToCoords(UUID scopeID, string mapName, int xloc, int yloc, out string reason) private GridRegion TryLinkRegionToCoords(UUID scopeID, string mapName, int xloc, int yloc, out string reason)
{ {
return TryLinkRegionToCoords(scopeID, mapName, xloc, yloc, UUID.Zero, out reason); return TryLinkRegionToCoords(scopeID, mapName, xloc, yloc, UUID.Zero, out reason);
} }
public GridRegion TryLinkRegionToCoords(UUID scopeID, string mapName, int xloc, int yloc, UUID ownerID, out string reason) private GridRegion TryLinkRegionToCoords(UUID scopeID, string mapName, int xloc, int yloc, UUID ownerID, out string reason)
{ {
reason = string.Empty; reason = string.Empty;
GridRegion regInfo = null; GridRegion regInfo = null;
@ -275,12 +275,20 @@ namespace OpenSim.Services.GridService
return null; return null;
} }
public bool TryCreateLink(UUID scopeID, int xloc, int yloc, string remoteRegionName, uint externalPort, string externalHostName, UUID ownerID, out GridRegion regInfo, out string reason) private bool TryCreateLink(UUID scopeID, int xloc, int yloc, string remoteRegionName, uint externalPort, string externalHostName, UUID ownerID, out GridRegion regInfo, out string reason)
{ {
return TryCreateLink(scopeID, xloc, yloc, remoteRegionName, externalPort, externalHostName, null, ownerID, out regInfo, out reason); return TryCreateLink(scopeID, xloc, yloc, remoteRegionName, externalPort, externalHostName, null, ownerID, out regInfo, out reason);
} }
public bool TryCreateLink(UUID scopeID, int xloc, int yloc, string remoteRegionName, uint externalPort, string externalHostName, string serverURI, UUID ownerID, out GridRegion regInfo, out string reason) private bool TryCreateLink(UUID scopeID, int xloc, int yloc, string remoteRegionName, uint externalPort, string externalHostName, string serverURI, UUID ownerID, out GridRegion regInfo, out string reason)
{
lock (this)
{
return TryCreateLinkImpl(scopeID, xloc, yloc, remoteRegionName, externalPort, externalHostName, serverURI, ownerID, out regInfo, out reason);
}
}
private bool TryCreateLinkImpl(UUID scopeID, int xloc, int yloc, string remoteRegionName, uint externalPort, string externalHostName, string serverURI, UUID ownerID, out GridRegion regInfo, out string reason)
{ {
m_log.InfoFormat("[HYPERGRID LINKER]: Link to {0} {1}, in <{2},{3}>", m_log.InfoFormat("[HYPERGRID LINKER]: Link to {0} {1}, in <{2},{3}>",
((serverURI == null) ? (externalHostName + ":" + externalPort) : serverURI), ((serverURI == null) ? (externalHostName + ":" + externalPort) : serverURI),