summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--PICA_id.h2
-rwxr-xr-xPICA_node.c19
-rwxr-xr-xPICA_node.h6
3 files changed, 17 insertions, 10 deletions
diff --git a/PICA_id.h b/PICA_id.h
index 538d0fd..5972655 100644
--- a/PICA_id.h
+++ b/PICA_id.h
@@ -19,4 +19,4 @@ char *PICA_id_to_base64(const unsigned char *id, char *buf);
}
#endif
-#endif \ No newline at end of file
+#endif
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);
diff --git a/PICA_node.h b/PICA_node.h
index 43b24f5..27011ee 100755
--- a/PICA_node.h
+++ b/PICA_node.h
@@ -67,9 +67,9 @@
#define PICA_NETWORKNAME "TESTNET" // TEMP //CONF
-#define NEWCONN_BUFSIZE 64
-//#define CL_RBUFSIZE 32
-//#define CL_WBUFSIZE 128
+#define NEWCONN_BUFSIZE 58 //FIXME this is the size of CONNID packet, this packet is followed by TLS session negotiation data.
+ //TLS data must not be interpreted as some PICA packet by PICA_processdatastream(),
+ //so buffer size is limited by the size of CONNID.
#define DEFAULT_BUF_SIZE 4096