summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authoryangwei <[email protected]>2024-05-22 15:20:05 +0800
committeryangwei <[email protected]>2024-05-22 15:20:05 +0800
commit4c21db35ccd2ed6bf05dd42d1eb7e127bcb86e79 (patch)
tree7ac02b034d4c5e7878a0f81d6f6256cc4ec01363 /src
parentfdc699228d0cd1f75510d8a06f1b5455f2e7b81d (diff)
🐞 fix(session_state_update_on_sapp): Fix incorrect session statev2.0.1
Diffstat (limited to 'src')
-rw-r--r--src/stellar_on_sapp/stellar_on_sapp.h2
-rw-r--r--src/stellar_on_sapp/stellar_on_sapp_api.c4
-rw-r--r--src/stellar_on_sapp/stellar_on_sapp_loader.c10
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;