You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
internalreadonlyint_id;// in debug mode every packet is assigned a unique id so that the entire lifetime can be tracked when debugging
31
+
internalreadonlySniHandle_owner;// used in debug builds to check that packets are being returned to the correct pool
32
+
33
+
#if DEBUG
32
34
/// refcount = 0 means that a packet should only exist in the pool
33
35
/// refcount = 1 means that a packet is active
34
36
/// refcount > 1 means that a packet has been reused in some way and is a serious error
35
37
internalint_refCount;
36
-
internalreadonlySniHandle_owner;// used in debug builds to check that packets are being returned to the correct pool
37
38
internalstring_traceTag;// used in debug builds to assist tracing what steps the packet has been through
38
39
39
40
#if TRACE_HISTORY
@@ -60,17 +61,6 @@ public enum Direction
60
61
/// </summary>
61
62
publicboolIsActive=>_refCount==1;
62
63
63
-
publicSniPacket(SniHandleowner,intid)
64
-
:this()
65
-
{
66
-
#if TRACE_HISTORY
67
-
_history=newList<History>();
68
-
#endif
69
-
_id=id;
70
-
_owner=owner;
71
-
SqlClientEventSource.Log.TrySNITraceEvent(nameof(SniPacket),EventType.INFO,"Connection Id {0}, Packet Id {1} instantiated,",args0:_owner?.ConnectionId,args1:_id);
72
-
}
73
-
74
64
// the finalizer is only included in debug builds and is used to ensure that all packets are correctly recycled
75
65
// it is not an error if a packet is dropped but it is undesirable so all efforts should be made to make sure we
76
66
// do not drop them for the GC to pick up
@@ -83,8 +73,15 @@ public SniPacket(SniHandle owner, int id)
83
73
}
84
74
85
75
#endif
86
-
publicSniPacket()
76
+
77
+
publicSniPacket(SniHandleowner,intid)
87
78
{
79
+
#if DEBUG&&TRACE_HISTORY
80
+
_history=newList<History>();
81
+
#endif
82
+
_id=id;
83
+
_owner=owner;
84
+
SqlClientEventSource.Log.TrySNITraceEvent(nameof(SniPacket),EventType.INFO,"Connection Id {0}, Packet Id {1} instantiated,",args0:_owner?.ConnectionId,args1:_id);
SqlClientEventSource.Log.TrySNITraceEvent(nameof(SniPacket),EventType.ERR,"Connection Id {0}, Internal Exception occurred while reading data: {1}",args0:packet._owner?.ConnectionId,args1:e?.Message);
291
-
#endif
292
287
error=true;
293
288
}
294
289
else
295
290
{
296
291
packet._dataLength=task.Result;
297
-
#if DEBUG
298
292
SqlClientEventSource.Log.TrySNITraceEvent(nameof(SniPacket),EventType.INFO,"Connection Id {0}, Packet Id {1} _dataLength {2} read from stream.",args0:packet._owner?.ConnectionId,args1:packet._id,args2:packet._dataLength);
SqlClientEventSource.Log.TrySNITraceEvent(nameof(SniPacket),EventType.ERR,"Connection Id {0}, No data read from stream, connection was terminated.",args0:packet._owner?.ConnectionId);
0 commit comments