diff options
author | Martin Willi <martin@strongswan.org> | 2005-11-16 16:10:23 +0000 |
---|---|---|
committer | Martin Willi <martin@strongswan.org> | 2005-11-16 16:10:23 +0000 |
commit | a698ba19a4679367ed97e5c671c526e4b273aaff (patch) | |
tree | 4df98497d5dff2d807d743c986a273ceae078866 | |
parent | 66e379a278e6e422eb3c4bd66c0ad7645a3c54ef (diff) | |
download | strongswan-a698ba19a4679367ed97e5c671c526e4b273aaff.tar.bz2 strongswan-a698ba19a4679367ed97e5c671c526e4b273aaff.tar.xz |
- uses new packet with host_t now
-rw-r--r-- | Source/charon/socket.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/Source/charon/socket.c b/Source/charon/socket.c index 89a6c11a6..b98d04540 100644 --- a/Source/charon/socket.c +++ b/Source/charon/socket.c @@ -54,16 +54,18 @@ status_t receiver(private_socket_t *this, packet_t **packet) { char buffer[MAX_PACKET]; int oldstate; - packet_t *pkt = packet_create(AF_INET); - + packet_t *pkt = packet_create(); /* add packet destroy handler for cancellation, enable cancellation */ pthread_cleanup_push((void(*)(void*))pkt->destroy, (void*)pkt); pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, &oldstate); + + pkt->source = host_create(AF_INET, "0.0.0.0", 0); /* do the read */ pkt->data.len = recvfrom(this->socket_fd, buffer, MAX_PACKET, 0, - &(pkt->source), &(pkt->sockaddr_len)); + pkt->source->get_sockaddr(pkt->source), + pkt->source->get_sockaddr_len(pkt->source)); /* reset cancellation, remove packet destroy handler (without executing) */ pthread_setcancelstate(oldstate, NULL); @@ -99,7 +101,8 @@ status_t sender(private_socket_t *this, packet_t *packet) /* send data */ bytes_sent = sendto(this->socket_fd, packet->data.ptr, packet->data.len, - 0, &(packet->destination), packet->sockaddr_len); + 0, packet->destination->get_sockaddr(packet->destination), + *(packet->destination->get_sockaddr_len(packet->destination))); if (bytes_sent != packet->data.len) { |