Skip to content

Commit

Permalink
Make connection facotries internal
Browse files Browse the repository at this point in the history
  • Loading branch information
pepone committed Oct 30, 2024
1 parent ad2508e commit 7652fbb
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 33 deletions.
64 changes: 32 additions & 32 deletions csharp/src/Ice/Internal/ConnectionFactory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@

namespace Ice.Internal;

public class MultiDictionary<K, V> : Dictionary<K, ICollection<V>> where K : class
internal class MultiDictionary<K, V> : Dictionary<K, ICollection<V>> where K : class
{
public void Add(K key, V value)
internal void Add(K key, V value)
{
if (!TryGetValue(key, out ICollection<V>? list))
{
Expand All @@ -19,7 +19,7 @@ public void Add(K key, V value)
list.Add(value);
}

public void Remove(K key, V value)
internal void Remove(K key, V value)
{
ICollection<V> list = this[key];
list.Remove(value);
Expand All @@ -30,16 +30,16 @@ public void Remove(K key, V value)
}
}

public sealed class OutgoingConnectionFactory
internal sealed class OutgoingConnectionFactory
{
public interface CreateConnectionCallback
internal interface CreateConnectionCallback
{
void setConnection(ConnectionI connection, bool compress);

void setException(LocalException ex);
}

public void destroy()
internal void destroy()
{
lock (_mutex)
{
Expand All @@ -62,7 +62,7 @@ public void destroy()
}
}

public void updateConnectionObservers()
internal void updateConnectionObservers()
{
lock (_mutex)
{
Expand All @@ -76,7 +76,7 @@ public void updateConnectionObservers()
}
}

public void waitUntilFinished()
internal void waitUntilFinished()
{
Dictionary<Connector, ICollection<ConnectionI>> connections;
lock (_mutex)
Expand All @@ -102,7 +102,7 @@ public void waitUntilFinished()
}
}

public void create(
internal void create(
List<EndpointI> endpoints,
bool hasMore,
EndpointSelectionType selType,
Expand All @@ -129,7 +129,7 @@ public void create(
cb.getConnectors();
}

public void setRouterInfo(RouterInfo routerInfo)
internal void setRouterInfo(RouterInfo routerInfo)
{
Debug.Assert(routerInfo is not null);
ObjectAdapter adapter = routerInfo.getAdapter();
Expand Down Expand Up @@ -169,7 +169,7 @@ public void setRouterInfo(RouterInfo routerInfo)
}
}

public void removeAdapter(ObjectAdapter adapter)
internal void removeAdapter(ObjectAdapter adapter)
{
lock (_mutex)
{
Expand All @@ -191,7 +191,7 @@ public void removeAdapter(ObjectAdapter adapter)
}
}

public void flushAsyncBatchRequests(CompressBatch compressBatch, CommunicatorFlushBatchAsync outAsync)
internal void flushAsyncBatchRequests(CompressBatch compressBatch, CommunicatorFlushBatchAsync outAsync)
{
var c = new List<ConnectionI>();

Expand Down Expand Up @@ -653,8 +653,8 @@ public override bool Equals(object? obj) =>

public override int GetHashCode() => connector.GetHashCode();

public Connector connector;
public EndpointI endpoint;
internal Connector connector;
internal EndpointI endpoint;
}

private class ConnectCallback : ConnectionI.StartCallback, EndpointI_connectors
Expand Down Expand Up @@ -744,7 +744,7 @@ public void exception(LocalException ex)
}
}

public void setConnection(ConnectionI connection, bool compress)
internal void setConnection(ConnectionI connection, bool compress)
{
//
// Callback from the factory: the connection to one of the callback
Expand All @@ -754,7 +754,7 @@ public void setConnection(ConnectionI connection, bool compress)
_factory.decPendingConnectCount(); // Must be called last.
}

public void setException(LocalException ex)
internal void setException(LocalException ex)
{
//
// Callback from the factory: connection establishment failed.
Expand All @@ -763,17 +763,17 @@ public void setException(LocalException ex)
_factory.decPendingConnectCount(); // Must be called last.
}

public bool hasConnector(ConnectorInfo ci) => _connectors.Contains(ci);
internal bool hasConnector(ConnectorInfo ci) => _connectors.Contains(ci);

public bool removeConnectors(List<ConnectorInfo> connectors)
internal bool removeConnectors(List<ConnectorInfo> connectors)
{
_connectors.RemoveAll(ci => connectors.Contains(ci));
return _connectors.Count == 0;
}

public void removeFromPending() => _factory.removeFromPending(this, _connectors);
internal void removeFromPending() => _factory.removeFromPending(this, _connectors);

public void getConnectors()
internal void getConnectors()
{
try
{
Expand Down Expand Up @@ -933,7 +933,7 @@ private bool connectionStartFailedImpl(LocalException ex)
private readonly object _mutex = new();
}

public sealed class IncomingConnectionFactory : EventHandler, ConnectionI.StartCallback
internal sealed class IncomingConnectionFactory : EventHandler, ConnectionI.StartCallback
{
private class StartAcceptor(IncomingConnectionFactory factory) : TimerTask
{
Expand All @@ -942,7 +942,7 @@ private class StartAcceptor(IncomingConnectionFactory factory) : TimerTask
private readonly IncomingConnectionFactory _factory = factory;
}

public void startAcceptor()
internal void startAcceptor()
{
lock (_mutex)
{
Expand All @@ -963,31 +963,31 @@ public void startAcceptor()
}
}

public void activate()
internal void activate()
{
lock (_mutex)
{
setState(StateActive);
}
}

public void hold()
internal void hold()
{
lock (_mutex)
{
setState(StateHolding);
}
}

public void destroy()
internal void destroy()
{
lock (_mutex)
{
setState(StateClosed);
}
}

public void updateConnectionObservers()
internal void updateConnectionObservers()
{
lock (_mutex)
{
Expand All @@ -998,7 +998,7 @@ public void updateConnectionObservers()
}
}

public void waitUntilHolding()
internal void waitUntilHolding()
{
ICollection<ConnectionI> connections;

Expand All @@ -1021,7 +1021,7 @@ public void waitUntilHolding()
}
}

public void waitUntilFinished()
internal void waitUntilFinished()
{
ICollection<ConnectionI> connections;

Expand Down Expand Up @@ -1049,15 +1049,15 @@ public void waitUntilFinished()
}
}

public EndpointI endpoint()
internal EndpointI endpoint()
{
lock (_mutex)
{
return _endpoint;
}
}

public ICollection<ConnectionI> connections()
internal ICollection<ConnectionI> connections()
{
lock (_mutex)
{
Expand All @@ -1076,7 +1076,7 @@ public ICollection<ConnectionI> connections()
}
}

public void flushAsyncBatchRequests(CompressBatch compressBatch, CommunicatorFlushBatchAsync outAsync)
internal void flushAsyncBatchRequests(CompressBatch compressBatch, CommunicatorFlushBatchAsync outAsync)
{
// connections() is synchronized, no need to synchronize here.
foreach (ConnectionI connection in connections())
Expand Down Expand Up @@ -1335,7 +1335,7 @@ public void connectionStartFailed(ConnectionI connection, LocalException ex)
// Do not warn about connection exceptions here. The connection is not yet validated.
}

public IncomingConnectionFactory(Instance instance, EndpointI endpoint, ObjectAdapter adapter)
internal IncomingConnectionFactory(Instance instance, EndpointI endpoint, ObjectAdapter adapter)
{
_instance = instance;
_connectionOptions = instance.serverConnectionOptions(adapter.getName());
Expand Down
2 changes: 1 addition & 1 deletion csharp/src/Ice/Internal/Instance.cs
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ internal ReferenceFactory referenceFactory()
}
}

public OutgoingConnectionFactory outgoingConnectionFactory()
internal OutgoingConnectionFactory outgoingConnectionFactory()
{
lock (_mutex)
{
Expand Down

0 comments on commit 7652fbb

Please sign in to comment.