@@ -19,15 +19,11 @@ You should have received a copy of the GNU Lesser General Public License
1919 along with this program. If not, see <http://www.gnu.org/licenses/>.
2020*/
2121
22- #nullable disable
23-
2422using System ;
2523using System . Collections . Generic ;
2624using System . Diagnostics ;
2725using System . Linq ;
2826using System . Threading ;
29- using JetBrains . Annotations ;
30-
3127namespace NetMQ . Core
3228{
3329 /// <summary>
@@ -54,7 +50,7 @@ public class Endpoint
5450 /// </summary>
5551 /// <param name="socket">the socket for this new Endpoint</param>
5652 /// <param name="options">the Options to assign to this new Endpoint</param>
57- public Endpoint ( [ NotNull ] SocketBase socket , [ NotNull ] Options options )
53+ public Endpoint ( SocketBase socket , Options options )
5854 {
5955 Socket = socket ;
6056 Options = options ;
@@ -63,13 +59,11 @@ public Endpoint([NotNull] SocketBase socket, [NotNull] Options options)
6359 /// <summary>
6460 /// Get the socket associated with this Endpoint.
6561 /// </summary>
66- [ NotNull ]
6762 public SocketBase Socket { get ; }
6863
6964 /// <summary>
7065 /// Get the Options of this Endpoint.
7166 /// </summary>
72- [ NotNull ]
7367 public Options Options { get ; }
7468 }
7569
@@ -109,7 +103,7 @@ public Endpoint([NotNull] SocketBase socket, [NotNull] Options options)
109103 /// <summary>
110104 /// The reaper thread.
111105 /// </summary>
112- [ CanBeNull ] private Reaper m_reaper ;
106+ private Reaper ? m_reaper ;
113107
114108 /// <summary>
115109 /// List of I/O threads.
@@ -124,7 +118,7 @@ public Endpoint([NotNull] SocketBase socket, [NotNull] Options options)
124118 /// <summary>
125119 /// Array of pointers to mailboxes for both application and I/O threads.
126120 /// </summary>
127- [ CanBeNull ] private IMailbox [ ] m_slots ;
121+ private IMailbox ? [ ] ? m_slots ;
128122
129123 /// <summary>
130124 /// Mailbox for zmq_term thread.
@@ -202,9 +196,9 @@ public void Terminate(bool block)
202196 socket . Stop ( ) ;
203197
204198 if ( ! block )
205- m_reaper . ForceStop ( ) ;
199+ m_reaper ! . ForceStop ( ) ;
206200 else if ( m_sockets . Count == 0 )
207- m_reaper . Stop ( ) ;
201+ m_reaper ! . Stop ( ) ;
208202 }
209203 finally
210204 {
@@ -265,7 +259,6 @@ public int MaxSockets
265259 /// <exception cref="TerminatingException">Cannot create new socket while terminating.</exception>
266260 /// <exception cref="NetMQException">Maximum number of sockets reached.</exception>
267261 /// <exception cref="TerminatingException">The context (Ctx) must not be already terminating.</exception>
268- [ NotNull ]
269262 public SocketBase CreateSocket ( ZmqSocketType type )
270263 {
271264 lock ( m_slotSync )
@@ -343,7 +336,7 @@ public SocketBase CreateSocket(ZmqSocketType type)
343336 SocketBase s = SocketBase . Create ( type , this , slot , socketId ) ;
344337
345338 m_sockets . Add ( s ) ;
346- m_slots [ slot ] = s . Mailbox ;
339+ m_slots ! [ slot ] = s . Mailbox ;
347340
348341 //LOG.debug("NEW Slot [" + slot + "] " + s);
349342
@@ -359,14 +352,14 @@ public SocketBase CreateSocket(ZmqSocketType type)
359352 /// <remarks>
360353 /// If this was the last socket, then stop the reaper.
361354 /// </remarks>
362- public void DestroySocket ( [ NotNull ] SocketBase socket )
355+ public void DestroySocket ( SocketBase socket )
363356 {
364357 // Free the associated thread slot.
365358 lock ( m_slotSync )
366359 {
367360 int threadId = socket . ThreadId ;
368361 m_emptySlots . Push ( threadId ) ;
369- m_slots [ threadId ] . Close ( ) ;
362+ m_slots ! [ threadId ] ! . Close ( ) ;
370363 m_slots [ threadId ] = null ;
371364
372365 // Remove the socket from the list of sockets.
@@ -375,7 +368,7 @@ public void DestroySocket([NotNull] SocketBase socket)
375368 // If zmq_term() was already called and there are no more socket
376369 // we can ask reaper thread to terminate.
377370 if ( m_terminating && m_sockets . Count == 0 )
378- m_reaper . Stop ( ) ;
371+ m_reaper ! . Stop ( ) ;
379372 }
380373
381374 //LOG.debug("Released Slot [" + socket_ + "] ");
@@ -386,31 +379,30 @@ public void DestroySocket([NotNull] SocketBase socket)
386379 /// </summary>
387380 public ZObject GetReaper ( )
388381 {
389- return m_reaper ;
382+ return m_reaper ! ;
390383 }
391384
392385 /// <summary>
393386 /// Send a command to the given destination thread.
394387 /// </summary>
395- public void SendCommand ( int threadId , [ NotNull ] Command command )
388+ public void SendCommand ( int threadId , Command command )
396389 {
397- m_slots [ threadId ] . Send ( command ) ;
390+ m_slots ! [ threadId ] ! . Send ( command ) ;
398391 }
399392
400393 /// <summary>
401394 /// Returns the <see cref="IOThread"/> that is the least busy at the moment.
402395 /// </summary>
403396 /// <paramref name="affinity">Which threads are eligible (0 = all).</paramref>
404397 /// <returns>The least busy thread, or <c>null</c> if none is available.</returns>
405- [ CanBeNull ]
406- public IOThread ChooseIOThread ( long affinity )
398+ public IOThread ? ChooseIOThread ( long affinity )
407399 {
408400 if ( m_ioThreads . Count == 0 )
409401 return null ;
410402
411403 // Find the I/O thread with minimum load.
412404 int minLoad = - 1 ;
413- IOThread selectedIOThread = null ;
405+ IOThread ? selectedIOThread = null ;
414406
415407 for ( int i = 0 ; i != m_ioThreads . Count ; i ++ )
416408 {
@@ -435,7 +427,7 @@ public IOThread ChooseIOThread(long affinity)
435427 /// <param name="address">the textual name to give this endpoint</param>
436428 /// <param name="endpoint">the Endpoint to remember</param>
437429 /// <returns>true if the given address was NOT already registered</returns>
438- public bool RegisterEndpoint ( [ NotNull ] string address , [ NotNull ] Endpoint endpoint )
430+ public bool RegisterEndpoint ( string address , Endpoint endpoint )
439431 {
440432 lock ( m_endpointsSync )
441433 {
@@ -453,12 +445,12 @@ public bool RegisterEndpoint([NotNull] string address, [NotNull] Endpoint endpoi
453445 /// <param name="address">the (string) address denoting the endpoint to unregister</param>
454446 /// <param name="socket">the socket associated with that endpoint</param>
455447 /// <returns>true if the endpoint having this address and socket is found, false otherwise</returns>
456- public bool UnregisterEndpoint ( [ NotNull ] string address , [ NotNull ] SocketBase socket )
448+ public bool UnregisterEndpoint ( string address , SocketBase socket )
457449 {
458450 lock ( m_endpointsSync )
459451 {
460452
461- if ( ! m_endpoints . TryGetValue ( address , out Endpoint endpoint ) )
453+ if ( ! m_endpoints . TryGetValue ( address , out Endpoint ? endpoint ) )
462454 return false ;
463455
464456 if ( socket != endpoint . Socket )
@@ -473,7 +465,7 @@ public bool UnregisterEndpoint([NotNull] string address, [NotNull] SocketBase so
473465 /// Remove from the list of endpoints, all endpoints that reference the given socket.
474466 /// </summary>
475467 /// <param name="socket">the socket to remove all references to</param>
476- public void UnregisterEndpoints ( [ NotNull ] SocketBase socket )
468+ public void UnregisterEndpoints ( SocketBase socket )
477469 {
478470 lock ( m_endpointsSync )
479471 {
@@ -494,11 +486,8 @@ public void UnregisterEndpoints([NotNull] SocketBase socket)
494486 /// By calling this method, the socket associated with that returned EndPoint has it's Seqnum incremented,
495487 /// in order to prevent it from being de-allocated before a command can be sent to it.
496488 /// </remarks>
497- [ NotNull ]
498- public Endpoint FindEndpoint ( [ NotNull ] string addr )
489+ public Endpoint FindEndpoint ( string addr )
499490 {
500- Debug . Assert ( addr != null ) ;
501-
502491 lock ( m_endpointsSync )
503492 {
504493 if ( ! m_endpoints . ContainsKey ( addr ) )
0 commit comments