Have the follow code keep track of whether there's any data in the TCP
stream, and, if there isn't, pop up a dialog indicating that there isn't any data in the stream. This fixes bug 1604. svn path=/trunk/; revision=21870
This commit is contained in:
parent
360624a4c7
commit
6559749cd1
|
@ -51,7 +51,8 @@ typedef struct _tcp_frag {
|
|||
|
||||
FILE* data_out_file = NULL;
|
||||
|
||||
gboolean incomplete_tcp_stream = FALSE;
|
||||
gboolean empty_tcp_stream;
|
||||
gboolean incomplete_tcp_stream;
|
||||
|
||||
static guint8 ip_address[2][MAX_IPADDR_LEN];
|
||||
static guint tcp_port[2];
|
||||
|
@ -304,9 +305,12 @@ check_fragments( int index, tcp_stream_chunk *sc ) {
|
|||
|
||||
/* this should always be called before we start to reassemble a stream */
|
||||
void
|
||||
reset_tcp_reassembly() {
|
||||
reset_tcp_reassembly(void)
|
||||
{
|
||||
tcp_frag *current, *next;
|
||||
int i;
|
||||
|
||||
empty_tcp_stream = TRUE;
|
||||
incomplete_tcp_stream = FALSE;
|
||||
for( i=0; i<2; i++ ) {
|
||||
seq[i] = 0;
|
||||
|
@ -332,4 +336,5 @@ write_packet_data( int index, tcp_stream_chunk *sc, const char *data )
|
|||
DISSECTOR_ASSERT(1 * sizeof(tcp_stream_chunk) == fwrite( sc, 1, sizeof(tcp_stream_chunk), data_out_file ));
|
||||
DISSECTOR_ASSERT(1 * sc->dlen == fwrite( data, 1, sc->dlen, data_out_file ));
|
||||
bytes_written[index] += sc->dlen;
|
||||
empty_tcp_stream = FALSE;
|
||||
}
|
||||
|
|
|
@ -32,6 +32,7 @@
|
|||
#define MAX_IPADDR_LEN 16
|
||||
|
||||
/* With MSVC and a libwireshark.dll, we need a special declaration. */
|
||||
WS_VAR_IMPORT gboolean empty_tcp_stream;
|
||||
WS_VAR_IMPORT gboolean incomplete_tcp_stream;
|
||||
|
||||
typedef struct _tcp_stream_chunk {
|
||||
|
|
|
@ -256,7 +256,6 @@ follow_stream_cb(GtkWidget * w, gpointer data _U_)
|
|||
"!(%s)", follow_filter);
|
||||
}
|
||||
|
||||
|
||||
gtk_entry_set_text(GTK_ENTRY(filter_te), follow_filter);
|
||||
|
||||
/* Run the display filter so it goes in effect - even if it's the
|
||||
|
@ -266,6 +265,16 @@ follow_stream_cb(GtkWidget * w, gpointer data _U_)
|
|||
/* Free the filter string, as we're done with it. */
|
||||
g_free(follow_filter);
|
||||
|
||||
/* Check whether we got any data written to the file. */
|
||||
if (empty_tcp_stream) {
|
||||
simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
|
||||
"The packets in the capture file for that stream have no data.");
|
||||
eth_close(tmp_fd);
|
||||
unlink(follow_info->data_out_filename);
|
||||
g_free(follow_info);
|
||||
return;
|
||||
}
|
||||
|
||||
/* Go back to the top of the file and read the first tcp_stream_chunk
|
||||
* to ensure that the IP addresses and port numbers in the drop-down
|
||||
* list are tied to the correct lines displayed by follow_read_stream()
|
||||
|
|
Loading…
Reference in New Issue