Commit 825a4929dac5d991c384bd9ee18c693458f7f055

Authored by aliguori
1 parent 978d5d73

Make sure to resume the monitor only after flushing out outstanding

network traffic.

This was bug was reported by Chris Lalancette.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>



git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5640 c046a42c-6fe2-441c-8c8c-71466251a162
Showing 1 changed file with 6 additions and 8 deletions
migration-tcp.c
... ... @@ -40,19 +40,11 @@ typedef struct FdMigrationState
40 40 do { } while (0)
41 41 #endif
42 42  
43   -int debug_me = 0;
44   -
45 43 static void tcp_cleanup(FdMigrationState *s)
46 44 {
47   - if (s->detach == 2) {
48   - monitor_resume();
49   - s->detach = 0;
50   - }
51   -
52 45 qemu_set_fd_handler2(s->fd, NULL, NULL, NULL, NULL);
53 46  
54 47 if (s->file) {
55   - debug_me = 1;
56 48 dprintf("closing file\n");
57 49 qemu_fclose(s->file);
58 50 }
... ... @@ -60,6 +52,12 @@ static void tcp_cleanup(FdMigrationState *s)
60 52 if (s->fd != -1)
61 53 close(s->fd);
62 54  
  55 + /* Don't resume monitor until we've flushed all of the buffers */
  56 + if (s->detach == 2) {
  57 + monitor_resume();
  58 + s->detach = 0;
  59 + }
  60 +
63 61 s->fd = -1;
64 62 }
65 63  
... ...