packet_list_freeze();
+ /*g_log(NULL, G_LOG_LEVEL_MESSAGE, "cf_continue_tail: %u new: %u", cf->count, to_read);*/
+
while (to_read != 0 && (wtap_read(cf->wth, err, &err_info, &data_offset))) {
if (cf->state == FILE_READ_ABORTED) {
/* Well, the user decided to exit Ethereal. Break out of the
to_read--;
}
+ /*g_log(NULL, G_LOG_LEVEL_MESSAGE, "cf_continue_tail: count %u state: %u err: %u",
+ cf->count, cf->state, *err);*/
+
/* XXX - this cheats and looks inside the packet list to find the final
row number. */
if (auto_scroll_live && cf->plist_end != NULL)
return CF_READ_ABORTED;
} else if (*err != 0) {
/* We got an error reading the capture file.
- XXX - pop up a dialog box? */
+ XXX - pop up a dialog box instead? */
+ g_warning("Error \"%s\" while reading: \"%s\"\n",
+ wtap_strerror(*err), cf->filename);
+
return CF_READ_ERROR;
} else
return CF_READ_OK;
read_packet(cf, data_offset);
}
+ packet_list_thaw();
+
if (cf->state == FILE_READ_ABORTED) {
/* Well, the user decided to abort the read. We're only called
when the child capture process closes the pipe to us (meaning
return CF_READ_ABORTED;
}
- packet_list_thaw();
if (auto_scroll_live && cf->plist_end != NULL)
/* XXX - this cheats and looks inside the packet list to find the final
row number. */
/* try to read data from the pipe only 5 times, to avoid blocking */
while(iterations < 5) {
+ /*g_log(NULL, G_LOG_LEVEL_DEBUG, "pipe_timer_cb: new iteration");*/
+
/* Oddly enough although Named pipes don't work on win9x,
PeekNamedPipe does !!! */
handle = (HANDLE) _get_osfhandle (pipe_input->source);
callback */
if (!result || avail > 0 || childstatus != STILL_ACTIVE) {
+ /*g_log(NULL, G_LOG_LEVEL_DEBUG, "pipe_timer_cb: data avail");*/
+
if(pipe_input->pipe_input_id != 0) {
+ /*g_log(NULL, G_LOG_LEVEL_DEBUG, "pipe_timer_cb: stop timer");*/
/* avoid reentrancy problems and stack overflow */
gtk_timeout_remove(pipe_input->pipe_input_id);
pipe_input->pipe_input_id = 0;
/* And call the real handler */
if (!pipe_input->input_cb(pipe_input->source, pipe_input->user_data)) {
+ g_log(NULL, G_LOG_LEVEL_DEBUG, "pipe_timer_cb: input pipe closed, iterations: %u", iterations);
/* pipe closed, return false so that the old timer is not run again */
return FALSE;
}
}
else {
+ /*g_log(NULL, G_LOG_LEVEL_DEBUG, "pipe_timer_cb: no data avail");*/
/* No data, stop now */
break;
}
if(pipe_input->pipe_input_id == 0) {
/* restore pipe handler */
pipe_input->pipe_input_id = gtk_timeout_add(200, pipe_timer_cb, data);
+ /*g_log(NULL, G_LOG_LEVEL_DEBUG, "pipe_timer_cb: finished with iterations: %u, new timer", iterations);*/
/* Return false so that the old timer is not run again */
return FALSE;
} else {
+ /*g_log(NULL, G_LOG_LEVEL_DEBUG, "pipe_timer_cb: finished with iterations: %u, old timer", iterations);*/
+
/* we didn't stopped the old timer, so let it run */
return TRUE;
}
this but doesn't seem to work over processes. Attempt to do
something similar here, start a timer and check for data on every
timeout. */
+ /*g_log(NULL, G_LOG_LEVEL_DEBUG, "pipe_input_set_handler: new");*/
pipe_input.pipe_input_id = gtk_timeout_add(200, pipe_timer_cb, &pipe_input);
#else
pipe_input.pipe_input_id = gtk_input_add_full(source,
{
switch(event) {
case(cf_cb_file_closing):
+ g_log(LOG_DOMAIN_MAIN, G_LOG_LEVEL_DEBUG, "Callback: Closing");
main_cf_cb_file_closing(data);
break;
case(cf_cb_file_closed):
+ g_log(LOG_DOMAIN_MAIN, G_LOG_LEVEL_DEBUG, "Callback: Closed");
main_cf_cb_file_closed(data);
break;
case(cf_cb_file_read_start):
+ g_log(LOG_DOMAIN_MAIN, G_LOG_LEVEL_DEBUG, "Callback: Read start");
main_cf_cb_file_read_start(data);
break;
case(cf_cb_file_read_finished):
+ g_log(LOG_DOMAIN_MAIN, G_LOG_LEVEL_DEBUG, "Callback: Read finished");
main_cf_cb_file_read_finished(data);
break;
#ifdef HAVE_LIBPCAP
case(cf_cb_live_capture_prepared):
+ g_log(LOG_DOMAIN_MAIN, G_LOG_LEVEL_DEBUG, "Callback: capture prepared");
main_cf_cb_live_capture_prepared(data);
break;
case(cf_cb_live_capture_update_started):
+ g_log(LOG_DOMAIN_MAIN, G_LOG_LEVEL_DEBUG, "Callback: capture update started");
main_cf_cb_live_capture_update_started(data);
break;
case(cf_cb_live_capture_update_continue):
+ /*g_log(LOG_DOMAIN_MAIN, G_LOG_LEVEL_DEBUG, "Callback: capture update continue");*/
main_cf_cb_live_capture_update_continue(data);
break;
case(cf_cb_live_capture_fixed_started):
+ g_log(LOG_DOMAIN_MAIN, G_LOG_LEVEL_DEBUG, "Callback: capture fixed started");
main_cf_cb_live_capture_fixed_started(data);
break;
case(cf_cb_live_capture_update_finished):
+ g_log(LOG_DOMAIN_MAIN, G_LOG_LEVEL_DEBUG, "Callback: capture update finished");
main_cf_cb_live_capture_update_finished(data);
break;
case(cf_cb_live_capture_fixed_finished):
+ g_log(LOG_DOMAIN_MAIN, G_LOG_LEVEL_DEBUG, "Callback: capture fixed finished");
main_cf_cb_live_capture_fixed_finished(data);
break;
case(cf_cb_live_capture_stopping):
+ g_log(LOG_DOMAIN_MAIN, G_LOG_LEVEL_DEBUG, "Callback: capture stopping");
main_cf_cb_live_capture_stopping(data);
break;
#endif
main_cf_cb_field_unselected(data);
break;
case(cf_cb_file_safe_started):
+ g_log(LOG_DOMAIN_MAIN, G_LOG_LEVEL_DEBUG, "Callback: safe started");
main_cf_cb_file_safe_started(data);
break;
case(cf_cb_file_safe_finished):
+ g_log(LOG_DOMAIN_MAIN, G_LOG_LEVEL_DEBUG, "Callback: safe finished");
main_cf_cb_file_safe_finished(data);
break;
case(cf_cb_file_safe_reload_finished):
+ g_log(LOG_DOMAIN_MAIN, G_LOG_LEVEL_DEBUG, "Callback: reload finished");
main_cf_cb_file_safe_reload_finished(data);
break;
case(cf_cb_file_safe_failed):
+ g_log(LOG_DOMAIN_MAIN, G_LOG_LEVEL_DEBUG, "Callback: safe failed");
main_cf_cb_file_safe_failed(data);
break;
default:
g_log_set_handler(NULL,
log_flags,
console_log_handler, NULL /* user_data */);
+ g_log_set_handler(LOG_DOMAIN_MAIN,
+ log_flags,
+ console_log_handler, NULL /* user_data */);
#ifdef HAVE_LIBPCAP
g_log_set_handler(LOG_DOMAIN_CAPTURE,
/* capture child domain (the capture child might also contain file domain messages!) */
#define LOG_DOMAIN_CAPTURE_CHILD "CaptureChild"
+/* main domain */
+#define LOG_DOMAIN_MAIN "Main"
/* enable very verbose capture log debug output */
/*#define LOG_CAPTURE_VERBOSE*/