aboutsummaryrefslogtreecommitdiff
path: root/src/testspdy/test_session_timeout.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/testspdy/test_session_timeout.c')
-rw-r--r--src/testspdy/test_session_timeout.c32
1 files changed, 20 insertions, 12 deletions
diff --git a/src/testspdy/test_session_timeout.c b/src/testspdy/test_session_timeout.c
index 66872d72..a89933b4 100644
--- a/src/testspdy/test_session_timeout.c
+++ b/src/testspdy/test_session_timeout.c
@@ -22,7 +22,7 @@
22 * client 22 * client
23 * @author Andrey Uzunov 23 * @author Andrey Uzunov
24 */ 24 */
25 25
26#include "platform.h" 26#include "platform.h"
27#include "microspdy.h" 27#include "microspdy.h"
28#include "stdio.h" 28#include "stdio.h"
@@ -66,6 +66,9 @@ void
66new_session_cb (void *cls, 66new_session_cb (void *cls,
67 struct SPDY_Session * session) 67 struct SPDY_Session * session)
68{ 68{
69 (void)cls;
70 (void)session;
71
69 if(!new_session)do_sleep = 1; 72 if(!new_session)do_sleep = 1;
70 new_session = 1; 73 new_session = 1;
71 printf("new session\n"); 74 printf("new session\n");
@@ -76,6 +79,9 @@ closed_session_cb (void *cls,
76 struct SPDY_Session * session, 79 struct SPDY_Session * session,
77 int by_client) 80 int by_client)
78{ 81{
82 (void)cls;
83 (void)session;
84
79 printf("closed_session_cb called\n"); 85 printf("closed_session_cb called\n");
80 86
81 if(SPDY_YES == by_client) 87 if(SPDY_YES == by_client)
@@ -150,20 +156,20 @@ parentproc()
150 killchild("clock_gettime returned wrong value"); 156 killchild("clock_gettime returned wrong value");
151 if(now - beginning > TIMEOUT*1000 + SELECT_MS_TIMEOUT) 157 if(now - beginning > TIMEOUT*1000 + SELECT_MS_TIMEOUT)
152 { 158 {
153 printf("Started at: %ims\n",beginning); 159 printf("Started at: %llums\n",beginning);
154 printf("Now is: %ims\n",now); 160 printf("Now is: %llums\n",now);
155 printf("Timeout is: %i\n",TIMEOUT); 161 printf("Timeout is: %i\n",TIMEOUT);
156 printf("Select Timeout is: %ims\n",SELECT_MS_TIMEOUT); 162 printf("Select Timeout is: %ims\n",SELECT_MS_TIMEOUT);
157 printf("SPDY_get_timeout gave: %ims\n",timeoutlong); 163 printf("SPDY_get_timeout gave: %llums\n",timeoutlong);
158 killchild("Timeout passed but session was not closed"); 164 killchild("Timeout passed but session was not closed");
159 } 165 }
160 if(timeoutlong > beginning + TIMEOUT *1000) 166 if(timeoutlong > beginning + TIMEOUT *1000)
161 { 167 {
162 printf("Started at: %ims\n",beginning); 168 printf("Started at: %llums\n",beginning);
163 printf("Now is: %ims\n",now); 169 printf("Now is: %llums\n",now);
164 printf("Timeout is: %i\n",TIMEOUT); 170 printf("Timeout is: %i\n",TIMEOUT);
165 printf("Select Timeout is: %ims\n",SELECT_MS_TIMEOUT); 171 printf("Select Timeout is: %ims\n",SELECT_MS_TIMEOUT);
166 printf("SPDY_get_timeout gave: %ims\n",timeoutlong); 172 printf("SPDY_get_timeout gave: %llums\n",timeoutlong);
167 killchild("SPDY_get_timeout returned wrong timeout"); 173 killchild("SPDY_get_timeout returned wrong timeout");
168 } 174 }
169 } 175 }
@@ -210,10 +216,12 @@ parentproc()
210 default: 216 default:
211 SPDY_run(daemon); 217 SPDY_run(daemon);
212 if(0 == beginning) 218 if(0 == beginning)
213 if (clock_gettime(CLOCK_MONOTONIC, &ts) == 0) 219 {
214 beginning = ts.tv_nsec / 1000000 + ts.tv_sec*1000; 220 if (clock_gettime(CLOCK_MONOTONIC, &ts) == 0)
215 else 221 beginning = ts.tv_nsec / 1000000 + ts.tv_sec*1000;
216 killchild("clock_gettime returned wrong number"); 222 else
223 killchild("clock_gettime returned wrong number");
224 }
217 /*if(do_sleep) 225 /*if(do_sleep)
218 { 226 {
219 sleep(TIMEOUT); 227 sleep(TIMEOUT);
@@ -283,7 +291,7 @@ childproc()
283 291
284 292
285int 293int
286main(int argc, char **argv) 294main()
287{ 295{
288 port = get_port(11123); 296 port = get_port(11123);
289 parent = getpid(); 297 parent = getpid();