tags:

views:

32

answers:

1
+1  A: 

Check your if syntax :

if(connect(peer->fd,
       (struct sockaddr *)dst->sockaddr,
       sizeof(struct sockaddr_in)
       )
       address, dst->port);
    return -1;
}

There shouldn't be any semicolon at the end of the if condition. If this code ever compiles, then it will always returns -1.

Also check your indentation. It's all wrong. It could be hiding bugs, because we don't know what the last curly brace could be closing, and anyway it makes your code hard to read.

And finally, you shouldn't fail silently.

if(connect(peer->fd,
       (struct sockaddr *)dst->sockaddr,
       sizeof(struct sockaddr_in) == -1) {
    perror("---- [msrp_peer_connect]---- connect() failed");
    return -1;
}
BatchyX