Cleanup how we cast and close peers.

This commit is contained in:
Ian Gulliver
2016-03-08 20:41:00 -08:00
parent cd302a1746
commit d39cd62991
9 changed files with 33 additions and 37 deletions

View File

@@ -72,7 +72,7 @@ static void file_retry(struct file *file) {
uint32_t delay = wakeup_get_retry_delay_ms(file->attempt++);
LOG(file->id, "Will retry in %ds", delay / 1000);
file->peer.event_handler = file_open_wrapper;
wakeup_add((struct peer *) file, delay);
wakeup_add(&file->peer, delay);
}
static void file_handle_close(struct peer *peer) {
@@ -98,7 +98,7 @@ static void file_open(struct file *file) {
file->retry = file_should_retry(fd, file);
file->peer.event_handler = file_handle_close;
file->attempt = 0;
if (!flow_new_send_hello(fd, file->flow, file->passthrough, (struct peer *) file)) {
if (!flow_new_send_hello(fd, file->flow, file->passthrough, &file->peer)) {
LOG(file->id, "Error writing greeting");
file_retry(file);
return;