diff options
| author | yangwei <[email protected]> | 2024-01-18 18:08:55 +0800 |
|---|---|---|
| committer | æšćš <[email protected]> | 2024-01-29 05:52:26 +0000 |
| commit | ef7508b8809251730a0195ea4cad5d9af1175273 (patch) | |
| tree | 4be8ded65fd47a03d9ab991e26865c04318768cd | |
| parent | 656dcf70d214513636df15191de903c7eb0abb91 (diff) | |
đ fix(detach check for tcp/tcpall): add tcp entry for detach check
| -rw-r--r-- | src/adapter/adapter.c | 18 | ||||
| -rw-r--r-- | src/adapter/adapter.h | 1 | ||||
| -rw-r--r-- | src/stellar_on_sapp/defer_loader.inf | 4 | ||||
| -rw-r--r-- | src/stellar_on_sapp/start_loader.inf | 4 | ||||
| -rw-r--r-- | src/stellar_on_sapp/stellar_on_sapp.c | 13 |
5 files changed, 35 insertions, 5 deletions
diff --git a/src/adapter/adapter.c b/src/adapter/adapter.c index 92cfd62..3e7d4bb 100644 --- a/src/adapter/adapter.c +++ b/src/adapter/adapter.c @@ -193,6 +193,15 @@ void adapter_session_free(struct session *sess) return session_free(sess); } +int adapter_session_get_detach_others(struct session *sess) +{ + if(sess) + { + return sess->set_detach_others; + } + return 0; +} + unsigned char adapter_session_state_update(struct streaminfo *stream, struct session *sess, void *a_packet, enum session_state state) { struct packet *pkt = NULL; @@ -201,19 +210,18 @@ unsigned char adapter_session_state_update(struct streaminfo *stream, struct ses pkt=(struct packet *)session_get0_current_packet(sess); pkt->raw_pkt=(void *)get_current_rawpkt_from_streaminfo(stream); session_dispatch( sess, state, pkt); - if(sess->set_detach_others==1) + if(adapter_session_get_detach_others(sess) == 1) { return APP_STATE_GIVEME|APP_STATE_KILL_OTHER; } - else - { - return APP_STATE_GIVEME; - } + return APP_STATE_GIVEME; } else return APP_STATE_DROPME; } + + const char* session_get0_readable_addr(struct session *sess) { return printaddr(&sess->cur_pkt->a_stream->addr, sess->cur_pkt->a_stream->threadnum); diff --git a/src/adapter/adapter.h b/src/adapter/adapter.h index 3559f1a..f4e6a5d 100644 --- a/src/adapter/adapter.h +++ b/src/adapter/adapter.h @@ -13,5 +13,6 @@ struct session *adapter_session_new(struct stellar *st, struct streaminfo *strea void adapter_session_free(struct session *sess); unsigned char adapter_session_state_update(struct streaminfo *stream, struct session *sess, void *a_packet, enum session_state state); +int adapter_session_get_detach_others(struct session *sess); void adapter_session_poll(struct session *sess);
\ No newline at end of file diff --git a/src/stellar_on_sapp/defer_loader.inf b/src/stellar_on_sapp/defer_loader.inf index f823103..ebe9dc1 100644 --- a/src/stellar_on_sapp/defer_loader.inf +++ b/src/stellar_on_sapp/defer_loader.inf @@ -12,6 +12,10 @@ FUNC_NAME=stellar_on_sapp_defer_entry #FUNC_FLAG=ALL #FUNC_NAME=stellar_on_sapp_defer_entry +#[TCP] +#FUNC_FLAG=ALL +#FUNC_NAME=stellar_on_sapp_detach_check_entry + [UDP] FUNC_FLAG=ALL FUNC_NAME=stellar_on_sapp_defer_entry
\ No newline at end of file diff --git a/src/stellar_on_sapp/start_loader.inf b/src/stellar_on_sapp/start_loader.inf index f966457..3cfe7c6 100644 --- a/src/stellar_on_sapp/start_loader.inf +++ b/src/stellar_on_sapp/start_loader.inf @@ -12,6 +12,10 @@ FUNC_NAME=stellar_on_sapp_tcpall_entry #FUNC_FLAG=ALL #FUNC_NAME=stellar_on_sapp_tcp_entry +#[TCP] +#FUNC_FLAG=ALL +#FUNC_NAME=stellar_on_sapp_detach_check_entry + [UDP] FUNC_FLAG=ALL FUNC_NAME=stellar_on_sapp_udp_entry
\ No newline at end of file diff --git a/src/stellar_on_sapp/stellar_on_sapp.c b/src/stellar_on_sapp/stellar_on_sapp.c index 634b0bf..42f2d27 100644 --- a/src/stellar_on_sapp/stellar_on_sapp.c +++ b/src/stellar_on_sapp/stellar_on_sapp.c @@ -171,6 +171,19 @@ unsigned char stellar_on_sapp_tcpall_entry(struct streaminfo *pstream,void **pme return loader_transfer_stream_entry(pstream, pstream->pktstate, pme, thread_seq, a_packet); } +unsigned char stellar_on_sapp_detach_check_entry(struct streaminfo *pstream,void **pme, int thread_seq,void *a_packet) +{ + struct session *sess=(struct session *)stream_bridge_async_data_get(pstream, g_session_bridge_id); + if(adapter_session_get_detach_others(sess) == 1) + { + return APP_STATE_DROPME|APP_STATE_KILL_OTHER; + } + else + { + return APP_STATE_GIVEME; + } +} + unsigned char stellar_on_sapp_tcp_entry(struct streaminfo *pstream,void **pme, int thread_seq,void *a_packet) { return loader_transfer_stream_entry(pstream, pstream->opstate, pme, thread_seq, a_packet); |
