summaryrefslogtreecommitdiffstats
path: root/PICA_node.c
diff options
context:
space:
mode:
authorme_desk <me_desk@fb96df88-216d-11de-830c-f3023f12d8ac>2013-08-22 21:22:29 +0000
committerme_desk <me_desk@fb96df88-216d-11de-830c-f3023f12d8ac>2013-08-22 21:22:29 +0000
commitbfd5528f28264772a245dc29f41d4bb5d29fb1eb (patch)
treec9f9beb72d7a91baaaf84117d6b541941306b524 /PICA_node.c
parentba711be9bdce4b3d0ced9bff5e2399aa3442e611 (diff)
downloadpica-pica-bfd5528f28264772a245dc29f41d4bb5d29fb1eb.tar.gz
pica-pica-bfd5528f28264772a245dc29f41d4bb5d29fb1eb.zip
fixed NEWCONN_BUFSIZE to make it equal to CONNID packet size in order to prevent interpreting TLS session data that follows this packet as some PICA protocol message. This is workaround, problem must be fixed in more proper way
git-svn-id: svn://localhost/project_picapica/trunk@265 fb96df88-216d-11de-830c-f3023f12d8ac
Diffstat (limited to 'PICA_node.c')
-rwxr-xr-xPICA_node.c19
1 files changed, 13 insertions, 6 deletions
diff --git a/PICA_node.c b/PICA_node.c
index 8afa573..09a3197 100755
--- a/PICA_node.c
+++ b/PICA_node.c
@@ -211,18 +211,26 @@ PICA_debug1("received CONNID");
caller_id = buf + 2;
callee_id = buf + 2 + PICA_ID_SIZE;
-//PICA_debug1("CONNID: caller_id=%u callee_id=%u",caller_id,callee_id);
+{
+char caller_id_buf[2 * PICA_ID_SIZE], callee_id_buf[2 * PICA_ID_SIZE];
+PICA_debug1("CONNID: caller_id=%s callee_id=%s",PICA_id_to_base64(caller_id, caller_id_buf),PICA_id_to_base64(callee_id, callee_id_buf));
+}
link=cclink_list_search(caller_id, callee_id);
if (!link)
+ {
+ PICA_debug3("corresponding cclink not found");
return 0;
-
+ }
if (link->state!=PICA_CCLINK_LOCAL_WAITCONNCLE && link->state!=PICA_CCLINK_LOCAL_WAITCONNCLR
&& link->state!=PICA_CCLINK_N2NCLR_WAITCONNCLR && link->state!=PICA_CCLINK_N2NCLE_WAITCONNCLE)
+ {
+ PICA_debug2("found cclink is not in expected state");
return 0;
-
+ }
+
{
struct client *c;
//проверка IP адреса.
@@ -266,7 +274,7 @@ if (link->state==PICA_CCLINK_N2NCLE_WAITCONNCLE)
return 0;
}
}
-
+PICA_debug3("CONNID processed successfully");
cclink_activate(link,nc->sck);
newconn_free(nc);
return 1;
@@ -1356,7 +1364,7 @@ return 1;
void newconn_close(struct newconn* nc)
{
CLOSE(nc->sck);
-PICA_debug2("closed socket %i", nc->sck);
+PICA_debug3("newconn_close(): nc = %p closed socket %i", nc, nc->sck);
nc->sck=0;
nc->pos=0;
@@ -2141,7 +2149,6 @@ for (i=0;i<MAX_NEWCONNS;i++)
if(!PICA_processdatastream(newconns[i].buf,&(newconns[i].pos),newconns+i /*arg*/,_msginfo_newconn, MSGINFO_MSGSNUM(_msginfo_newconn) ))
{
- //puts("processdatastream error\n");//debug
newconn_close(newconns+i);
}
//FD_CLR(newconns[i].sck,readfds);