From 4c21db35ccd2ed6bf05dd42d1eb7e127bcb86e79 Mon Sep 17 00:00:00 2001 From: yangwei Date: Wed, 22 May 2024 15:20:05 +0800 Subject: 🐞 fix(session_state_update_on_sapp): Fix incorrect session state MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/stellar_on_sapp/stellar_on_sapp.h | 2 +- src/stellar_on_sapp/stellar_on_sapp_api.c | 4 ++-- src/stellar_on_sapp/stellar_on_sapp_loader.c | 10 ++++------ 3 files changed, 7 insertions(+), 9 deletions(-) diff --git a/src/stellar_on_sapp/stellar_on_sapp.h b/src/stellar_on_sapp/stellar_on_sapp.h index 095af00..e93146f 100644 --- a/src/stellar_on_sapp/stellar_on_sapp.h +++ b/src/stellar_on_sapp/stellar_on_sapp.h @@ -11,7 +11,7 @@ void stellar_exit_on_sapp(struct stellar *st); struct session *session_new_on_sapp(struct stellar *st, struct streaminfo *stream); void session_free_on_sapp(struct session *sess); -unsigned char session_state_update_on_sapp(struct streaminfo *stream, struct session *sess, void *a_packet, enum packet_type type); +unsigned char session_state_update_on_sapp(struct streaminfo *stream, unsigned char stream_state, struct session *sess, void *a_packet, enum packet_type type); void session_poll_on_sapp(struct session *sess); diff --git a/src/stellar_on_sapp/stellar_on_sapp_api.c b/src/stellar_on_sapp/stellar_on_sapp_api.c index 3bb0190..063444c 100644 --- a/src/stellar_on_sapp/stellar_on_sapp_api.c +++ b/src/stellar_on_sapp/stellar_on_sapp_api.c @@ -123,11 +123,11 @@ void session_free_on_sapp(struct session *sess) * SESSION STATE UPDATE ON SAPP * *********************************************/ -unsigned char session_state_update_on_sapp(struct streaminfo *stream, struct session *sess, void *a_packet, enum packet_type type) +unsigned char session_state_update_on_sapp(struct streaminfo *stream, unsigned char stream_state, struct session *sess, void *a_packet, enum packet_type type) { if(sess && a_packet) { - sess->state=(stream->pktstate == OP_STATE_PENDING) ? SESSION_STATE_OPENING : SESSION_STATE_ACTIVE;; + sess->state=(stream_state == OP_STATE_PENDING) ? SESSION_STATE_OPENING : SESSION_STATE_ACTIVE; struct packet *pkt = sess->cur_pkt; pkt->raw_pkt=(void *)get_current_rawpkt_from_streaminfo(stream); pkt->type=type; diff --git a/src/stellar_on_sapp/stellar_on_sapp_loader.c b/src/stellar_on_sapp/stellar_on_sapp_loader.c index cd95d59..e377b98 100644 --- a/src/stellar_on_sapp/stellar_on_sapp_loader.c +++ b/src/stellar_on_sapp/stellar_on_sapp_loader.c @@ -102,7 +102,6 @@ void STELLAR_DEFER_LOADER_EXIT(void) static unsigned char loader_transfer_stream_entry(struct streaminfo *pstream, UCHAR state, void **pme, int thread_seq,void *a_packet, enum entry_type type) { - struct tcpdetail *pdetail=(struct tcpdetail *)pstream->pdetail; int is_ctrl_pkt=0; const void *raw_pkt=NULL; unsigned char entry_ret=APP_STATE_GIVEME; @@ -138,19 +137,19 @@ static unsigned char loader_transfer_stream_entry(struct streaminfo *pstream, UC session_exdata_set(sess, g_streaminfo_exdata_id, pstream); stream_bridge_async_data_put(pstream, g_session_bridge_id, sess); } - entry_ret = session_state_update_on_sapp(pstream, sess, a_packet, pkt_type); + entry_ret = session_state_update_on_sapp(pstream, state, sess, a_packet, pkt_type); break; case OP_STATE_DATA: raw_pkt = get_current_rawpkt_from_streaminfo(pstream); get_opt_from_rawpkt(raw_pkt, RAW_PKT_GET_IS_CTRL_PKT, (void *)&is_ctrl_pkt); if(is_ctrl_pkt==1) { - entry_ret=session_state_update_on_sapp(pstream, sess, a_packet, CONTROL); + entry_ret=session_state_update_on_sapp(pstream, state, sess, a_packet, CONTROL); entry_ret = entry_ret|APP_STATE_DROPPKT; } else { - entry_ret=session_state_update_on_sapp(pstream, sess, a_packet, pkt_type); + entry_ret=session_state_update_on_sapp(pstream, state, sess, a_packet, pkt_type); } break; case OP_STATE_CLOSE: @@ -158,9 +157,8 @@ static unsigned char loader_transfer_stream_entry(struct streaminfo *pstream, UC // for TCP stream, only trigger update when packet payload > 0 if(a_packet && pstream->ptcpdetail->datalen > 0) { - entry_ret=session_state_update_on_sapp(pstream, sess, a_packet, pkt_type); + entry_ret=session_state_update_on_sapp(pstream, state, sess, a_packet, pkt_type); } - FREE(*pme); break; default: break; -- cgit v1.2.3