@@ -64,19 +64,19 @@ internal static Dictionary<string, string> ParseTargetCookie(string? targetCooki
6464 return nodeDetails . Length != 2 ? null : nodeDetails [ 0 ] ;
6565 }
6666
67- internal static TargetCookie ? CreateTargetCookie ( string sessionId , string deviceId )
67+ internal static TargetCookie ? CreateTargetCookie ( string ? sessionId , string ? deviceId )
6868 {
6969 var nowInSeconds = GetNowInSeconds ( ) ;
7070 var targetCookieValue = new StringBuilder ( ) ;
71- long maxAge = 0 ;
71+ var maxAge = 0 ;
7272 maxAge = CreateSessionId ( sessionId , nowInSeconds , targetCookieValue , maxAge ) ;
7373 maxAge = CreateDeviceId ( deviceId , nowInSeconds , targetCookieValue , maxAge ) ;
7474 var cookieValue = targetCookieValue . ToString ( ) ;
7575
76- return string . IsNullOrEmpty ( cookieValue ) ? null : new TargetCookie ( TargetConstants . MboxCookieName , cookieValue , ( int ) ( maxAge / 1000 ) ) ;
76+ return string . IsNullOrEmpty ( cookieValue ) ? null : new TargetCookie ( TargetConstants . MboxCookieName , cookieValue , maxAge ) ;
7777 }
7878
79- internal static TargetCookie ? CreateClusterCookie ( string tntId )
79+ internal static TargetCookie ? CreateClusterCookie ( string ? tntId )
8080 {
8181 if ( tntId == null )
8282 {
@@ -90,45 +90,45 @@ internal static Dictionary<string, string> ParseTargetCookie(string? targetCooki
9090 return null ;
9191 }
9292
93- long maxAge = GetNowInSeconds ( ) + ClusterLocationHintMaxAge ;
93+ var maxAge = GetNowInSeconds ( ) + ClusterLocationHintMaxAge ;
9494
95- return new TargetCookie ( TargetConstants . ClusterCookieName , locationHint , ( int ) ( maxAge / 1000 ) ) ;
95+ return new TargetCookie ( TargetConstants . ClusterCookieName , locationHint , maxAge ) ;
9696 }
9797
9898 private static int GetNowInSeconds ( )
9999 {
100100 return ( int ) ( DateTimeOffset . UtcNow . ToUnixTimeMilliseconds ( ) / 1000 ) ;
101101 }
102102
103- private static long CreateDeviceId ( string deviceId , int nowInSeconds , StringBuilder targetCookieValue , long maxAge )
103+ private static int CreateDeviceId ( string ? deviceId , int nowInSeconds , StringBuilder targetCookieValue , int maxAge )
104104 {
105105 if ( string . IsNullOrEmpty ( deviceId ) )
106106 {
107107 return maxAge ;
108108 }
109109
110- long deviceIdMaxAge = nowInSeconds + DeviceIdCookieMaxAge ;
110+ var deviceIdMaxAge = nowInSeconds + DeviceIdCookieMaxAge ;
111111 maxAge = Math . Max ( maxAge , deviceIdMaxAge ) ;
112112 AppendCookieValue ( deviceId , targetCookieValue , deviceIdMaxAge , TargetConstants . DeviceIdCookieName ) ;
113113
114114 return maxAge ;
115115 }
116116
117- private static long CreateSessionId ( string sessionId , int nowInSeconds , StringBuilder targetCookieValue , long maxAge )
117+ private static int CreateSessionId ( string ? sessionId , int nowInSeconds , StringBuilder targetCookieValue , int maxAge )
118118 {
119119 if ( string . IsNullOrEmpty ( sessionId ) )
120120 {
121121 return maxAge ;
122122 }
123123
124- long sessionIdMaxAge = nowInSeconds + SessionIdCookieMaxAge ;
124+ var sessionIdMaxAge = nowInSeconds + SessionIdCookieMaxAge ;
125125 maxAge = sessionIdMaxAge ;
126126 AppendCookieValue ( sessionId , targetCookieValue , sessionIdMaxAge , TargetConstants . SessionIdCookieName ) ;
127127
128128 return maxAge ;
129129 }
130130
131- private static void AppendCookieValue ( string id , StringBuilder targetCookieValue , long maxAge , string cookieName )
131+ private static void AppendCookieValue ( string ? id , StringBuilder targetCookieValue , int maxAge , string cookieName )
132132 {
133133 targetCookieValue . Append ( cookieName )
134134 . Append ( InternalCookieSerializationSeparator )
0 commit comments