Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

C# visibility fixes #2976

Merged
merged 1 commit into from
Oct 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions csharp/src/Ice/ConnectionI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -364,10 +364,7 @@ internal int sendAsyncRequest(
}
}

public BatchRequestQueue getBatchRequestQueue()
{
return _batchRequestQueue;
}
internal BatchRequestQueue getBatchRequestQueue() => _batchRequestQueue;

public void flushBatchRequests(CompressBatch compress)
{
Expand Down
75 changes: 27 additions & 48 deletions csharp/src/Ice/Internal/BatchRequestQueue.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,55 +4,41 @@

namespace Ice.Internal;

internal sealed class BatchRequestI : Ice.BatchRequest
internal sealed class BatchRequestI : BatchRequest
{
public BatchRequestI(BatchRequestQueue queue)
{
_queue = queue;
}
internal BatchRequestI(BatchRequestQueue queue) => _queue = queue;

public void reset(Ice.ObjectPrx proxy, string operation, int size)
internal void reset(ObjectPrx proxy, string operation, int size)
{
_proxy = proxy;
_operation = operation;
_size = size;
}

public void enqueue()
{
_queue.enqueueBatchRequest(_proxy);
}
public void enqueue() => _queue.enqueueBatchRequest(_proxy);

public Ice.ObjectPrx getProxy()
{
return _proxy;
}
public ObjectPrx getProxy() => _proxy;

public string getOperation()
{
return _operation;
}
public string getOperation() => _operation;

public int getSize()
{
return _size;
}
public int getSize() => _size;

private readonly BatchRequestQueue _queue;
private Ice.ObjectPrx _proxy;
private ObjectPrx _proxy;
private string _operation;
private int _size;
}

public sealed class BatchRequestQueue
internal sealed class BatchRequestQueue
{
public BatchRequestQueue(Instance instance, bool datagram)
internal BatchRequestQueue(Instance instance, bool datagram)
{
Ice.InitializationData initData = instance.initializationData();
InitializationData initData = instance.initializationData();
_interceptor = initData.batchRequestInterceptor;
_batchStreamInUse = false;
_batchRequestNum = 0;
_batchStream = new OutputStream(Ice.Util.currentProtocolEncoding, instance.defaultsAndOverrides().defaultFormat);
_batchStream =
new OutputStream(Ice.Util.currentProtocolEncoding, instance.defaultsAndOverrides().defaultFormat);
_batchStream.writeBlob(Protocol.requestBatchHdr);
_batchMarker = _batchStream.size();
_request = new BatchRequestI(this);
Expand All @@ -70,8 +56,7 @@ public BatchRequestQueue(Instance instance, bool datagram)
}
}

public void
prepareBatchRequest(Ice.OutputStream os)
internal void prepareBatchRequest(OutputStream os)
{
lock (_mutex)
{
Expand All @@ -85,8 +70,7 @@ public void
}
}

public void
finishBatchRequest(Ice.OutputStream os, Ice.ObjectPrx proxy, string operation)
internal void finishBatchRequest(OutputStream os, ObjectPrx proxy, string operation)
{
//
// No need for synchronization, no other threads are supposed
Expand All @@ -112,7 +96,7 @@ public void
}
else
{
bool? compress = ((Ice.ObjectPrxHelperBase)proxy).iceReference().getCompressOverride();
bool? compress = ((ObjectPrxHelperBase)proxy).iceReference().getCompressOverride();
if (compress is not null)
{
_batchCompress |= compress.Value;
Expand All @@ -133,8 +117,7 @@ public void
}
}

public void
abortBatchRequest(Ice.OutputStream os)
internal void abortBatchRequest(OutputStream os)
{
lock (_mutex)
{
Expand All @@ -148,8 +131,7 @@ public void
}
}

public int
swap(Ice.OutputStream os, out bool compress)
internal int swap(OutputStream os, out bool compress)
{
lock (_mutex)
{
Expand Down Expand Up @@ -190,26 +172,23 @@ public int
}
}

public void
destroy(Ice.LocalException ex)
internal void destroy(LocalException ex)
{
lock (_mutex)
{
_exception = ex;
}
}

public bool
isEmpty()
internal bool isEmpty()
{
lock (_mutex)
{
return _batchStream.size() == Protocol.requestBatchHdr.Length;
}
}

private void
waitStreamInUse(bool flush)
private void waitStreamInUse(bool flush)
{
//
// This is similar to a mutex lock in that the stream is
Expand All @@ -223,10 +202,10 @@ private void
}
}

internal void enqueueBatchRequest(Ice.ObjectPrx proxy)
internal void enqueueBatchRequest(ObjectPrx proxy)
{
Debug.Assert(_batchMarker < _batchStream.size());
bool? compress = ((Ice.ObjectPrxHelperBase)proxy).iceReference().getCompressOverride();
bool? compress = ((ObjectPrxHelperBase)proxy).iceReference().getCompressOverride();
if (compress is not null)
{
_batchCompress |= compress.Value;
Expand All @@ -235,17 +214,17 @@ internal void enqueueBatchRequest(Ice.ObjectPrx proxy)
++_batchRequestNum;
}

private readonly object _mutex = new object();
private readonly object _mutex = new();

private readonly System.Action<Ice.BatchRequest, int, int> _interceptor;
private Ice.OutputStream _batchStream;
private readonly System.Action<BatchRequest, int, int> _interceptor;
private OutputStream _batchStream;
private bool _batchStreamInUse;
private bool _batchStreamCanFlush;
private int _batchRequestNum;
private int _batchMarker;
private bool _batchCompress;
private BatchRequestI _request;
private Ice.LocalException _exception;
private LocalException _exception;
private readonly int _maxSize;
private const int _udpOverhead = 20 + 8;
}
2 changes: 1 addition & 1 deletion csharp/src/Ice/Internal/OutgoingAsync.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1469,7 +1469,7 @@ public CommunicatorFlushBatchAsync(Instance instance, OutgoingAsyncCompletionCal
_useCount = 1;
}

public void flushConnection(Ice.ConnectionI con, Ice.CompressBatch compressBatch)
internal void flushConnection(Ice.ConnectionI con, Ice.CompressBatch compressBatch)
{
lock (mutex_)
{
Expand Down
Loading