diff options
| author | yangwei <[email protected]> | 2024-07-24 11:58:14 +0800 |
|---|---|---|
| committer | yangwei <[email protected]> | 2024-07-24 12:03:40 +0800 |
| commit | af19e929b05536d28dcffeb530ccbe72bcb74f21 (patch) | |
| tree | ea38087ee552a9a401509e52f7cf90500712f534 | |
| parent | 55d4639c91c6f2b1b3f89353099a7cb6f47ee46f (diff) | |
✨ feat(packet.h): add packet_get_session
| -rw-r--r-- | include/stellar/packet.h | 4 | ||||
| -rw-r--r-- | src/stellar_on_sapp/stellar_on_sapp_api.c | 6 | ||||
| -rw-r--r-- | src/stellar_on_sapp/stellar_on_sapp_loader.c | 4 |
3 files changed, 11 insertions, 3 deletions
diff --git a/include/stellar/packet.h b/include/stellar/packet.h index a777ec1..6bb09f7 100644 --- a/include/stellar/packet.h +++ b/include/stellar/packet.h @@ -22,4 +22,6 @@ 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); -int packet_get_current_thread_id(struct packet *pkt);
\ No newline at end of file +int packet_get_current_thread_id(struct packet *pkt); + +struct session *packet_get_session(const 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 4c72542..dafdd3c 100644 --- a/src/stellar_on_sapp/stellar_on_sapp_api.c +++ b/src/stellar_on_sapp/stellar_on_sapp_api.c @@ -335,6 +335,12 @@ int packet_get_current_thread_id(struct packet *pkt) return thread_id; } +inline struct session *packet_get_session(const struct packet *pkt) +{ + if(pkt==NULL)return NULL; + return pkt->sess; +} + /********************************************* * SESSION INFO INTERFACE WRAPPER ON SAPP* *********************************************/ diff --git a/src/stellar_on_sapp/stellar_on_sapp_loader.c b/src/stellar_on_sapp/stellar_on_sapp_loader.c index 1c4de39..2e59f87 100644 --- a/src/stellar_on_sapp/stellar_on_sapp_loader.c +++ b/src/stellar_on_sapp/stellar_on_sapp_loader.c @@ -1,5 +1,5 @@ #include "stellar/stellar.h" -#include "stellar/session_exdata.h" +#include "stellar/stellar_exdata.h" #include "stellar_on_sapp.h" @@ -48,7 +48,7 @@ int STELLAR_START_LOADER_INIT() g_session_bridge_id=stream_bridge_build(STELLAR_BRIDEGE_NAME, "w"); if(g_session_bridge_id < 0)return -1; stream_bridge_register_data_free_cb(g_session_bridge_id, stellar_on_sapp_bridge_free); - g_streaminfo_exdata_id=stellar_session_exdata_new_index(g_stellar, STELLAR_EXDATA_NAME, NULL, NULL); + g_streaminfo_exdata_id=stellar_exdata_new_index(g_stellar, STELLAR_EXDATA_NAME, NULL, NULL); if(g_streaminfo_exdata_id < 0)return -1; return 0; } |
