comparison src/c/urweb.c @ 669:f68eee90dbcf

Press a button to send a message
author Adam Chlipala <adamc@hcoop.net>
date Sun, 22 Mar 2009 15:16:34 -0400
parents b0c1a46b1f15
children 729e65db2e2f
comparison
equal deleted inserted replaced
668:b0c1a46b1f15 669:f68eee90dbcf
340 client *c = cs->data; 340 client *c = cs->data;
341 341
342 pthread_mutex_lock(&c->data.used.lock); 342 pthread_mutex_lock(&c->data.used.lock);
343 343
344 if (c->data.used.sock != -1) { 344 if (c->data.used.sock != -1) {
345 printf("Immediate send\n");
345 uw_really_send(c->data.used.sock, begin_msgs, sizeof(begin_msgs) - 1); 346 uw_really_send(c->data.used.sock, begin_msgs, sizeof(begin_msgs) - 1);
346 uw_really_send(c->data.used.sock, pre, preLen); 347 uw_really_send(c->data.used.sock, pre, preLen);
347 uw_really_send(c->data.used.sock, msg, len); 348 uw_really_send(c->data.used.sock, msg, len);
348 uw_really_send(c->data.used.sock, "\n", 1); 349 uw_really_send(c->data.used.sock, "\n", 1);
349 close(c->data.used.sock); 350 close(c->data.used.sock);
350 c->data.used.sock = -1; 351 c->data.used.sock = -1;
351 } else { 352 } else {
353 printf("Delayed send\n");
352 buf_append(&c->data.used.msgs, pre, preLen); 354 buf_append(&c->data.used.msgs, pre, preLen);
353 buf_append(&c->data.used.msgs, msg, len); 355 buf_append(&c->data.used.msgs, msg, len);
354 buf_append(&c->data.used.msgs, "\n", 1); 356 buf_append(&c->data.used.msgs, "\n", 1);
355 } 357 }
356 358