Skip to content
Snippets Groups Projects
Commit 542379d6 authored by ram's avatar ram
Browse files

Added some fflushes.

parent c8035f81
No related branches found
No related tags found
No related merge requests found
...@@ -202,6 +202,7 @@ void write_text_callback(message_t reply,XmTextVerifyCallbackStruct *info) ...@@ -202,6 +202,7 @@ void write_text_callback(message_t reply,XmTextVerifyCallbackStruct *info)
message_write_int(reply,info->text->format,int_tag); message_write_int(reply,info->text->format,int_tag);
printf("modifying_text_value: %s ; length=%d\n",info->text->ptr, printf("modifying_text_value: %s ; length=%d\n",info->text->ptr,
info->text->length); info->text->length);
fflush(stdout);
} }
} }
......
...@@ -154,11 +154,13 @@ void message_write_int_list(message_t message,IntList *list,int tag) ...@@ -154,11 +154,13 @@ void message_write_int_list(message_t message,IntList *list,int tag)
void message_write_widget_list(message_t message,MyWidgetList *list,int tag) void message_write_widget_list(message_t message,MyWidgetList *list,int tag)
{ {
fprintf(stderr,">>>>> Warning:write_widget_list:We shouldn't be here!\n"); fprintf(stderr,">>>>> Warning:write_widget_list:We shouldn't be here!\n");
fflush(stderr);
} }
void message_write_resource_names(message_t message,ResourceList *list,int tag) void message_write_resource_names(message_t message,ResourceList *list,int tag)
{ {
fprintf(stderr,">>>>> Warning:write_resource_names:We shouldn't be here!\n"); fprintf(stderr,">>>>> Warning:write_resource_names:We shouldn't be here!\n");
fflush(stderr);
} }
void message_write_xm_string(message_t message,XmString xs,int tag) void message_write_xm_string(message_t message,XmString xs,int tag)
...@@ -384,6 +386,7 @@ void message_read_widget_list(message_t message,MyWidgetList *list, ...@@ -384,6 +386,7 @@ void message_read_widget_list(message_t message,MyWidgetList *list,
void message_read_int_list(message_t message,IntList *list,int tag,int length) void message_read_int_list(message_t message,IntList *list,int tag,int length)
{ {
fprintf(stderr,">>>>> Warning:message_read_int_list: Shouldn't be here.\n"); fprintf(stderr,">>>>> Warning:message_read_int_list: Shouldn't be here.\n");
fflush(stderr);
} }
void message_read_translation_table(message_t m,XtTranslations *t, void message_read_translation_table(message_t m,XtTranslations *t,
...@@ -436,6 +439,7 @@ void message_read_color(message_t m,XColor *color,int tag, int red) ...@@ -436,6 +439,7 @@ void message_read_color(message_t m,XColor *color,int tag, int red)
void message_read_float(message_t m,float *f,int tag,int data) void message_read_float(message_t m,float *f,int tag,int data)
{ {
fprintf(stderr,">>>>> Warning:message_read_float: Not implemented.\n"); fprintf(stderr,">>>>> Warning:message_read_float: Not implemented.\n");
fflush(stderr);
} }
...@@ -448,6 +452,7 @@ void toolkit_write_value(message_t message, caddr_t value, String type) ...@@ -448,6 +452,7 @@ void toolkit_write_value(message_t message, caddr_t value, String type)
type_tag = find_type_entry(type); type_tag = find_type_entry(type);
if( type_tag < 0 ) { if( type_tag < 0 ) {
fprintf(stderr,"Choked on type %s\n",type); fprintf(stderr,"Choked on type %s\n",type);
fflush(stderr);
fatal_error("Illegal type specified."); fatal_error("Illegal type specified.");
} }
......
...@@ -362,6 +362,7 @@ void write_event(message_t reply,XEvent *event) ...@@ -362,6 +362,7 @@ void write_event(message_t reply,XEvent *event)
break; break;
default: default:
printf("Unknown event type %d\n",event->type); printf("Unknown event type %d\n",event->type);
fflush(stdout);
break; break;
} }
} }
......
...@@ -124,6 +124,7 @@ void establish_client(int s) ...@@ -124,6 +124,7 @@ void establish_client(int s)
else else
printf("Server not forking.\n"); printf("Server not forking.\n");
fflush(stdout);
switch( pid ) { switch( pid ) {
case 0: /* The child process */ case 0: /* The child process */
close(unix_socket); close(unix_socket);
...@@ -197,6 +198,8 @@ main(int argc, char **argv) ...@@ -197,6 +198,8 @@ main(int argc, char **argv)
else else
printf(" No Unix domain socket created.\n"); printf(" No Unix domain socket created.\n");
fflush(stdout);
start_server(port, socket_path); start_server(port, socket_path);
/* Catch signals and remove our sockets before going away. */ /* Catch signals and remove our sockets before going away. */
...@@ -205,6 +208,7 @@ main(int argc, char **argv) ...@@ -205,6 +208,7 @@ main(int argc, char **argv)
signal(SIGQUIT, server_shutdown); signal(SIGQUIT, server_shutdown);
printf("Waiting for connection.\n"); printf("Waiting for connection.\n");
fflush(stdout);
FD_ZERO(&rfds); FD_ZERO(&rfds);
nfds = MAX(unix_socket,inet_socket)+1; nfds = MAX(unix_socket,inet_socket)+1;
...@@ -217,10 +221,12 @@ main(int argc, char **argv) ...@@ -217,10 +221,12 @@ main(int argc, char **argv)
if( FD_ISSET(unix_socket, &rfds) ) { if( FD_ISSET(unix_socket, &rfds) ) {
printf("Accepting client on Unix socket.\n"); printf("Accepting client on Unix socket.\n");
fflush(stdout);
establish_client(unix_socket); establish_client(unix_socket);
} }
if( FD_ISSET(inet_socket, &rfds) ) { if( FD_ISSET(inet_socket, &rfds) ) {
printf("Accepting client on Inet socket.\n"); printf("Accepting client on Inet socket.\n");
fflush(stdout);
establish_client(inet_socket); establish_client(inet_socket);
} }
/* Prevent zombie children under Mach */ /* Prevent zombie children under Mach */
......
...@@ -206,8 +206,9 @@ message_t message_read(int socket) { ...@@ -206,8 +206,9 @@ message_t message_read(int socket) {
count=first->total; count=first->total;
if( !count && !first->current ) { if( !count && !first->current ) {
kill_deferred_message(first->serial); kill_deferred_message(first->serial);
if( global_will_trace ) if( global_will_trace ) {
printf("Got cancellation for serial %d\n",first->serial); printf("Got cancellation for serial %d\n",first->serial);
fflush(stdout); }
} else if( count == 1 ) { } else if( count == 1 ) {
new = message_new(next_serial++); new = message_new(next_serial++);
new->packets = first; new->packets = first;
......
...@@ -119,6 +119,7 @@ void packet_send(int socket, packet_t packet) { ...@@ -119,6 +119,7 @@ void packet_send(int socket, packet_t packet) {
printf("packet_send: length = %u\n",packet->length); printf("packet_send: length = %u\n",packet->length);
printf("packet_send: this is packet %d of %d\n",packet->current, printf("packet_send: this is packet %d of %d\n",packet->current,
packet->total); packet->total);
fflush(stdout);
} }
packet_build_header(packet); packet_build_header(packet);
...@@ -159,6 +160,7 @@ void packet_read(int socket, packet_t packet) { ...@@ -159,6 +160,7 @@ void packet_read(int socket, packet_t packet) {
printf("packet_read: length = %u\n",packet->length); printf("packet_read: length = %u\n",packet->length);
printf("packet_read: This is packet %d of %d\n",packet->current, printf("packet_read: This is packet %d of %d\n",packet->current,
packet->total); packet->total);
fflush(stdout);
} }
while( target ) { while( target ) {
......
...@@ -155,8 +155,9 @@ void process_request(message_t message,int socket) ...@@ -155,8 +155,9 @@ void process_request(message_t message,int socket)
message_get_byte(message); /* This is ignored at the moment */ message_get_byte(message); /* This is ignored at the moment */
handler = request_table[request_op]; handler = request_table[request_op];
if( global_will_trace ) if( global_will_trace ) {
printf("Dispatching request for %d\n",request_op); printf("Dispatching request for %d\n",request_op);
fflush(stdout);}
(*handler)(message); (*handler)(message);
if( must_confirm ) if( must_confirm )
send_confirmation(message,socket); send_confirmation(message,socket);
......
...@@ -32,6 +32,7 @@ void fatal_error(char *message) ...@@ -32,6 +32,7 @@ void fatal_error(char *message)
fprintf(stderr,"%s\n",message); fprintf(stderr,"%s\n",message);
if( errno ) if( errno )
perror(NULL); perror(NULL);
fflush(stderr);
close(client_socket); close(client_socket);
if( !will_fork ) { if( !will_fork ) {
...@@ -47,6 +48,7 @@ void MyErrorHandler(String errmsg) ...@@ -47,6 +48,7 @@ void MyErrorHandler(String errmsg)
message_add_packet(reply); message_add_packet(reply);
fprintf(stderr,"Error: %s\n",errmsg); fprintf(stderr,"Error: %s\n",errmsg);
fflush(stderr);
message_put_dblword(reply,ERROR_REPLY); message_put_dblword(reply,ERROR_REPLY);
message_write_string(reply,errmsg,string_tag); message_write_string(reply,errmsg,string_tag);
message_send(client_socket,reply); message_send(client_socket,reply);
...@@ -62,6 +64,7 @@ void MyWarningHandler(String errmsg) ...@@ -62,6 +64,7 @@ void MyWarningHandler(String errmsg)
message_add_packet(reply); message_add_packet(reply);
fprintf(stderr,"Warning: %s\n",errmsg); fprintf(stderr,"Warning: %s\n",errmsg);
fflush(stderr);
message_put_dblword(reply,WARNING_REPLY); message_put_dblword(reply,WARNING_REPLY);
message_write_string(reply,errmsg,string_tag); message_write_string(reply,errmsg,string_tag);
message_send(client_socket,reply); message_send(client_socket,reply);
...@@ -73,14 +76,16 @@ void get_input(caddr_t closure, int *socket, XtInputId *id) ...@@ -73,14 +76,16 @@ void get_input(caddr_t closure, int *socket, XtInputId *id)
{ {
message_t message; message_t message;
if( global_will_trace ) if( global_will_trace ) {
printf("get_input: Receiving incoming packet.\n"); printf("get_input: Receiving incoming packet.\n");
fflush(stdout);}
message = message_read(*socket); message = message_read(*socket);
process_request(message,*socket); process_request(message,*socket);
if( global_will_trace ) if( global_will_trace ) {
printf("get_input: Successfully digested packet. Now freeing.\n"); printf("get_input: Successfully digested packet. Now freeing.\n");
fflush(stdout);}
message_free(message); message_free(message);
} }
...@@ -97,8 +102,9 @@ void greet_client(int socket) { ...@@ -97,8 +102,9 @@ void greet_client(int socket) {
else if( result == 1 ) read(socket,&byte+1,1); else if( result == 1 ) read(socket,&byte+1,1);
swap_bytes = (byte!=1); swap_bytes = (byte!=1);
if( global_will_trace ) if( global_will_trace ) {
printf("swap_bytes is: %d (from %d)\n",swap_bytes,byte); printf("swap_bytes is: %d (from %d)\n",swap_bytes,byte);
fflush(stdout);}
/* Read initial packet */ /* Read initial packet */
first = message_read(socket); first = message_read(socket);
...@@ -112,9 +118,10 @@ void greet_client(int socket) { ...@@ -112,9 +118,10 @@ void greet_client(int socket) {
global_app_class = XtNewString(app_class); global_app_class = XtNewString(app_class);
global_app_name = XtNewString(app_name); global_app_name = XtNewString(app_name);
if( global_will_trace ) if( global_will_trace ) {
printf("Opening display on '%s' for app '%s' class '%s'\n",dpy_name, printf("Opening display on '%s' for app '%s' class '%s'\n",dpy_name,
app_name,app_class); app_name,app_class);
fflush(stdout)};
display = XtOpenDisplay(app_context, dpy_name, display = XtOpenDisplay(app_context, dpy_name,
app_name, app_class, app_name, app_class,
NULL, 0, NULL, 0,
...@@ -168,8 +175,9 @@ void serve_client(int socket) ...@@ -168,8 +175,9 @@ void serve_client(int socket)
XtAppSetWarningHandler(app_context, MyWarningHandler); XtAppSetWarningHandler(app_context, MyWarningHandler);
/* Here is where we want to return on errors */ /* Here is where we want to return on errors */
if( setjmp(env) ) if( setjmp(env) ) {
printf("Attempting to recover from error.\n"); printf("Attempting to recover from error.\n");
fflush(stdout);}
while( !terminate_server ) { while( !terminate_server ) {
XtAppNextEvent(app_context, &event); XtAppNextEvent(app_context, &event);
XtDispatchEvent(&event); XtDispatchEvent(&event);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment