@@ -278,7 +278,7 @@ prepare_for_renew_session(tc_sess_t *s, tc_iph_t *ip, tc_tcph_t *tcp)
278
278
sec_tcp = NULL ;
279
279
s -> sm .need_rep_greet = 1 ;
280
280
281
- key = get_key ( ip -> saddr , tcp -> source ) ;
281
+ key = s -> hash_key ;
282
282
283
283
p = (unsigned char * ) hash_find (ctx .fir_auth_table , key );
284
284
@@ -361,6 +361,46 @@ proc_when_sess_created(tc_sess_t *s)
361
361
return TC_OK ;
362
362
}
363
363
364
+ static int
365
+ proc_when_sess_destroyed (tc_sess_t * s )
366
+ {
367
+ void * value ;
368
+ link_list * list ;
369
+ p_link_node ln , tln ;
370
+ mysql_table_item_t * item ;
371
+
372
+ value = hash_find (ctx .fir_auth_table , s -> hash_key );
373
+ if (value != NULL ) {
374
+ hash_del (ctx .fir_auth_table , ctx .pool , s -> hash_key );
375
+ tc_log_info (LOG_INFO , 0 , "hash del fir auth:%llu" , s -> hash_key );
376
+ }
377
+
378
+ value = hash_find (ctx .sec_auth_table , s -> hash_key );
379
+ if (value != NULL ) {
380
+ hash_del (ctx .sec_auth_table , ctx .pool , s -> hash_key );
381
+ tc_log_info (LOG_INFO , 0 , "hash del for sec auth:%llu" , s -> hash_key );
382
+ }
383
+
384
+ value = hash_find (ctx .table , s -> hash_key );
385
+ if (value != NULL ) {
386
+ item = value ;
387
+ list = item -> list ;
388
+ ln = link_list_first (list );
389
+ while (ln ) {
390
+ tln = ln ;
391
+ ln = link_list_get_next (list , ln );
392
+ link_list_remove (list , tln );
393
+ tc_pfree (ctx .pool , tln -> data );
394
+ tc_pfree (ctx .pool , tln );
395
+ }
396
+
397
+ tc_pfree (ctx .pool , list );
398
+
399
+ hash_del (ctx .table , ctx .pool , s -> hash_key );
400
+ }
401
+
402
+ return TC_OK ;
403
+ }
364
404
365
405
static int
366
406
proc_greet (tc_sess_t * s , tc_iph_t * ip , tc_tcph_t * tcp )
@@ -476,7 +516,7 @@ tc_module_t tc_mysql_module = {
476
516
prepare_for_renew_session ,
477
517
check_pack_needed_for_recons ,
478
518
proc_when_sess_created ,
479
- NULL ,
519
+ proc_when_sess_destroyed ,
480
520
proc_greet ,
481
521
proc_auth ,
482
522
check_needed_for_sec_auth ,
0 commit comments