fix crash by closing socket before deleting audio data

This commit is contained in:
Stephen Birarda 2013-02-11 17:07:56 -08:00
parent 52c410a65d
commit b3375c5e5f
3 changed files with 7 additions and 1 deletions

View file

@ -39,6 +39,7 @@ AudioData::~AudioData() {
}
}
delete[] samplesToQueue;
delete audioSocket;
}

View file

@ -51,6 +51,10 @@ UDPSocket::UDPSocket(int listeningPort) {
printf("Created UDP socket listening on port %d.\n", listeningPort);
}
UDPSocket::~UDPSocket() {
close(handle);
}
bool UDPSocket::receive(void *receivedData, int *receivedBytes) {
*receivedBytes = recvfrom(handle, receivedData, MAX_BUFFER_LENGTH_BYTES,

View file

@ -17,6 +17,7 @@
class UDPSocket {
public:
UDPSocket(int listening_port);
~UDPSocket();
int send(char *destAddress, int destPort, const void *data, int byteLength);
bool receive(void *receivedData, int *receivedBytes);
private: