summaryrefslogtreecommitdiff
path: root/gnuradio-core/src/lib
diff options
context:
space:
mode:
authorEric Blossom2010-05-19 20:02:26 -0700
committerEric Blossom2010-05-19 20:02:26 -0700
commit0058f55926c8e9f6ecb37f153ff7464b93838484 (patch)
tree274385207ff32f874c86c86eb3897b8142ce5558 /gnuradio-core/src/lib
parent68ce6b4a9b90d4d53310c4271e6011b796fc1bff (diff)
downloadgnuradio-0058f55926c8e9f6ecb37f153ff7464b93838484.tar.gz
gnuradio-0058f55926c8e9f6ecb37f153ff7464b93838484.tar.bz2
gnuradio-0058f55926c8e9f6ecb37f153ff7464b93838484.zip
Use -1 as file descriptor "not open" value instead of 0
Diffstat (limited to 'gnuradio-core/src/lib')
-rwxr-xr-xgnuradio-core/src/lib/io/gr_udp_sink.cc6
-rwxr-xr-xgnuradio-core/src/lib/io/gr_udp_source.cc6
2 files changed, 6 insertions, 6 deletions
diff --git a/gnuradio-core/src/lib/io/gr_udp_sink.cc b/gnuradio-core/src/lib/io/gr_udp_sink.cc
index 73e6d0283..2ee16b79f 100755
--- a/gnuradio-core/src/lib/io/gr_udp_sink.cc
+++ b/gnuradio-core/src/lib/io/gr_udp_sink.cc
@@ -97,7 +97,7 @@ gr_udp_sink::gr_udp_sink (size_t itemsize,
gr_make_io_signature (1, 1, itemsize),
gr_make_io_signature (0, 0, 0)),
d_itemsize (itemsize), d_payload_size(payload_size), d_eof(eof),
- d_connected(false)
+ d_socket(-1), d_connected(false)
{
#if defined(USING_WINSOCK) // for Windows (with MinGW)
// initialize winsock DLL
@@ -145,14 +145,14 @@ gr_udp_sink::~gr_udp_sink ()
if (d_connected)
disconnect();
- if (d_socket){
+ if (d_socket != -1){
shutdown(d_socket, SHUT_RDWR);
#if defined(USING_WINSOCK)
closesocket(d_socket);
#else
::close(d_socket);
#endif
- d_socket = 0;
+ d_socket = -1;
}
#if defined(USING_WINSOCK) // for Windows (with MinGW)
diff --git a/gnuradio-core/src/lib/io/gr_udp_source.cc b/gnuradio-core/src/lib/io/gr_udp_source.cc
index 15f83892c..b1c25382c 100755
--- a/gnuradio-core/src/lib/io/gr_udp_source.cc
+++ b/gnuradio-core/src/lib/io/gr_udp_source.cc
@@ -104,7 +104,7 @@ gr_udp_source::gr_udp_source(size_t itemsize, const char *host,
gr_make_io_signature(0, 0, 0),
gr_make_io_signature(1, 1, itemsize)),
d_itemsize(itemsize), d_payload_size(payload_size),
- d_eof(eof), d_wait(wait), d_residual(0), d_temp_offset(0)
+ d_eof(eof), d_wait(wait), d_socket(-1), d_residual(0), d_temp_offset(0)
{
int ret = 0;
@@ -194,14 +194,14 @@ gr_udp_source::~gr_udp_source ()
{
delete [] d_temp_buff;
- if (d_socket){
+ if (d_socket != -1){
shutdown(d_socket, SHUT_RDWR);
#if defined(USING_WINSOCK)
closesocket(d_socket);
#else
::close(d_socket);
#endif
- d_socket = 0;
+ d_socket = -1;
}
#if defined(USING_WINSOCK) // for Windows (with MinGW)