Skip to content

Commit

Permalink
smpp: rework TCP connections
Browse files Browse the repository at this point in the history
  • Loading branch information
razvancrainea committed Jan 23, 2019
1 parent f79ae9a commit 029d9a9
Show file tree
Hide file tree
Showing 3 changed files with 139 additions and 153 deletions.
4 changes: 3 additions & 1 deletion modules/proto_smpp/proto_smpp.c
Expand Up @@ -259,6 +259,7 @@ static struct tcp_req smpp_current_req;
static int smpp_handle_req(struct tcp_req *req, struct tcp_connection *con)
{
long size;
struct receive_info local_rcv;

if (req->complete){
/* update the timeout - we successfully read the request */
Expand Down Expand Up @@ -287,9 +288,10 @@ static int smpp_handle_req(struct tcp_req *req, struct tcp_connection *con)
LM_DBG("We still have things on the pipe - "
"keeping connection \n");
}
local_rcv = con->rcv;

/* give the message to the registered functions */
handle_smpp_msg(req->buf, con);
handle_smpp_msg(req->buf, (smpp_session_t *)con->proto_data, &local_rcv);

if (!size && req != &smpp_current_req) {
/* if we no longer need this tcp_req
Expand Down
4 changes: 2 additions & 2 deletions modules/proto_smpp/proto_smpp.h
Expand Up @@ -42,7 +42,7 @@ typedef struct smpp_session {
struct ip_addr ip;
int port;

struct tcp_connection *conn;
int conn_id;

union {
smpp_bind_receiver_t receiver;
Expand All @@ -68,7 +68,7 @@ struct tcp_connection* smpp_sync_connect(struct socket_info* send_sock,

void enquire_link(unsigned int ticks, void *param);
void rpc_bind_sessions(int sender_id, void *param);
void handle_smpp_msg(char *buffer, struct tcp_connection *conn);
void handle_smpp_msg(char *buffer, smpp_session_t *session, struct receive_info *rcv);
void send_submit_or_deliver_request(str *msg, str *src, str *dst,
smpp_session_t *session);
smpp_session_t *smpp_session_new(str *name, struct ip_addr *ip, int port,
Expand Down

0 comments on commit 029d9a9

Please sign in to comment.