certi-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[certi-cvs] certi/libCERTI SocketMC.cc


From: certi-cvs
Subject: [certi-cvs] certi/libCERTI SocketMC.cc
Date: Sun, 02 Nov 2008 12:54:40 +0000

CVSROOT:        /sources/certi
Module name:    certi
Changes by:     Petr Gotthard <gotthardp>       08/11/02 12:54:40

Modified files:
        libCERTI       : SocketMC.cc 

Log message:
        Bug #21648: Replace exit() by throwing an exception.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/certi/libCERTI/SocketMC.cc?cvsroot=certi&r1=3.15&r2=3.16

Patches:
Index: SocketMC.cc
===================================================================
RCS file: /sources/certi/certi/libCERTI/SocketMC.cc,v
retrieving revision 3.15
retrieving revision 3.16
diff -u -b -r3.15 -r3.16
--- SocketMC.cc 12 Jun 2008 07:39:49 -0000      3.15
+++ SocketMC.cc 2 Nov 2008 12:54:40 -0000       3.16
@@ -93,7 +93,7 @@
 _socket_mc = socket(AF_INET, SOCK_DGRAM, 0);
 if (_socket_mc < 0) {
        perror("socket1");
-       exit(-1);
+        throw NetworkError("cannot create socket");
        }
 
 memset(&_sin, sizeof(_sin), sizeof(_sin));
@@ -104,7 +104,7 @@
 
 if (bind(_socket_mc, (struct sockaddr *)&_sin, _sinlen) < 0) {
        perror("SocketMC: bind");
-       exit(-1);
+        throw NetworkError("cannot bind");
        }
 
 // joindre le groupe multiCast
@@ -116,14 +116,14 @@
              IP_ADD_MEMBERSHIP,
              (char *)&_mreq, _mreqlen) < 0) {
        perror("setsockopt");
-       exit(-1);
+        throw NetworkError("cannot setsockopt");
        }
 
 // creation du socket emetteur
 _socket_emetteur = socket(AF_INET, SOCK_DGRAM, 0);
 if (_socket_emetteur < 0) {
        perror("socket2");
-       exit(-1);
+        throw NetworkError("cannot create socket");
        }
 
 memset(&_sin_e, sizeof(_sin_e), sizeof(_sin_e));
@@ -200,7 +200,7 @@
 
     if (cnt < 0) {
        perror("Send");
-       exit(-1);
+        throw NetworkError("cannot sendto");
     }
 }
 
@@ -216,7 +216,7 @@
                    (struct sockaddr *)&_sin, &_sinlen);
     if (cnt < 0) {
        perror("Recv");
-       exit(1);
+        throw NetworkError("cannot recvfrom");
     }
 
     return(inet_ntoa(_sin.sin_addr));




reply via email to

[Prev in Thread] Current Thread [Next in Thread]