summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoryangwei <[email protected]>2024-07-24 10:45:33 +0800
committeryangwei <[email protected]>2024-07-24 11:46:42 +0800
commitb710f16d49963880effe092788268e00b48c3b21 (patch)
tree1b225a2b4089f7596891d97aa2ee552e9e069375
parentf1b6662e4d561bb924efe4dc4256d4f34a5173a5 (diff)
✨ feat(session.h): add packet_get_current_thread_id
-rw-r--r--include/stellar/session.h3
-rw-r--r--src/stellar_on_sapp/stellar_on_sapp_api.c9
2 files changed, 11 insertions, 1 deletions
diff --git a/include/stellar/session.h b/include/stellar/session.h
index cc4a727..d4b3f6d 100644
--- a/include/stellar/session.h
+++ b/include/stellar/session.h
@@ -127,4 +127,5 @@ int packet_arrive_time(const struct packet *pkt, struct timeval *ts);
unsigned char packet_get_ip_protocol(struct packet *pkt);
void packet_drop(const struct packet *pkt);
-const char *packet_get0_readable_addr(struct packet *pkt); \ No newline at end of file
+const char *packet_get0_readable_addr(struct packet *pkt);
+int packet_get_current_thread_id(struct packet *pkt); \ No newline at end of file
diff --git a/src/stellar_on_sapp/stellar_on_sapp_api.c b/src/stellar_on_sapp/stellar_on_sapp_api.c
index 01b62bb..abf9664 100644
--- a/src/stellar_on_sapp/stellar_on_sapp_api.c
+++ b/src/stellar_on_sapp/stellar_on_sapp_api.c
@@ -326,6 +326,15 @@ const char *packet_get0_readable_addr(struct packet *pkt)
return printaddr(&pstream->addr, pstream->threadnum);
}
+int packet_get_current_thread_id(struct packet *pkt)
+{
+ int thread_id = -1;
+ struct streaminfo *pstream=pkt->pstream;
+ assert(pstream);
+ thread_id = pstream->threadnum;
+ return thread_id;
+}
+
/*********************************************
* SESSION INFO INTERFACE WRAPPER ON SAPP*
*********************************************/