move packet allocation to recv code to allow bigger buffers

This commit is contained in:
Vladimir 'phcoder' Serbinenko 2011-07-08 20:38:12 +02:00
parent 6a1af81a97
commit e2955971a3
7 changed files with 105 additions and 55 deletions

View file

@ -764,19 +764,10 @@ receive_packets (struct grub_net_card *card)
/* Maybe should be better have a fixed number of packets for each card
and just mark them as used and not used. */
struct grub_net_buff *nb;
grub_ssize_t actual;
nb = grub_netbuff_alloc (1500);
nb = card->driver->recv (card);
if (!nb)
{
grub_print_error ();
card->last_poll = grub_get_time_ms ();
return;
}
actual = card->driver->recv (card, nb);
if (actual < 0)
{
grub_netbuff_free (nb);
card->last_poll = grub_get_time_ms ();
break;
}