Respect the timeout when retrying.

Hey, I think the timeout is not taken care of on subsequent retries after the first retry. I tried to fix this.

p.s.: This is my first pull-request. Hope i did it right.