68 |
69 |
69 // fill session structure |
70 // fill session structure |
70 sn->sys_fd = request->connection->fd; |
71 sn->sys_fd = request->connection->fd; |
71 sn->sn.pool = pool_create(); |
72 sn->sn.pool = pool_create(); |
72 sn->sn.csd = stream_new_from_fd(request->connection->fd); |
73 sn->sn.csd = stream_new_from_fd(request->connection->fd); |
73 sn->sn.client = NULL; |
74 sn->sn.client = pblock_create_pool(sn->sn.pool, 8); |
74 sn->sn.next = NULL; |
75 sn->sn.next = NULL; |
75 sn->sn.fill = 1; |
76 sn->sn.fill = 1; |
76 sn->sn.subject = NULL; |
77 sn->sn.subject = NULL; |
|
78 |
|
79 /* add ip to sn->client pblock */ |
|
80 char ip_str[INET_ADDRSTRLEN]; |
|
81 if(inet_ntop( |
|
82 AF_INET, |
|
83 &request->connection->address.sin_addr, |
|
84 ip_str, |
|
85 INET_ADDRSTRLEN) != NULL) |
|
86 { |
|
87 pblock_kvinsert(pb_key_ip, ip_str, INET_ADDRSTRLEN, sn->sn.client); |
|
88 } |
77 |
89 |
78 // init NSAPI request structure |
90 // init NSAPI request structure |
79 if(request_initialize(request->pool, request, rq) != 0) { |
91 if(request_initialize(request->pool, request, rq) != 0) { |
80 printf("Cannot initialize request structure\n"); |
92 printf("Cannot initialize request structure\n"); |
81 return 1; |
93 return 1; |