diff options
Diffstat (limited to 'src/transport/test_transport_api_limited_sockets.c')
-rw-r--r-- | src/transport/test_transport_api_limited_sockets.c | 78 |
1 files changed, 39 insertions, 39 deletions
diff --git a/src/transport/test_transport_api_limited_sockets.c b/src/transport/test_transport_api_limited_sockets.c index d5c6934b5..a5d40479f 100644 --- a/src/transport/test_transport_api_limited_sockets.c +++ b/src/transport/test_transport_api_limited_sockets.c | |||
@@ -11,12 +11,12 @@ | |||
11 | WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | Affero General Public License for more details. | 13 | Affero General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU Affero General Public License | 15 | You should have received a copy of the GNU Affero General Public License |
16 | along with this program. If not, see <http://www.gnu.org/licenses/>. | 16 | along with this program. If not, see <http://www.gnu.org/licenses/>. |
17 | 17 | ||
18 | SPDX-License-Identifier: AGPL3.0-or-later | 18 | SPDX-License-Identifier: AGPL3.0-or-later |
19 | */ | 19 | */ |
20 | /** | 20 | /** |
21 | * @file transport/test_transport_api_limited_sockets.c | 21 | * @file transport/test_transport_api_limited_sockets.c |
22 | * @brief base test case for transport implementations | 22 | * @brief base test case for transport implementations |
@@ -33,7 +33,7 @@ | |||
33 | /** | 33 | /** |
34 | * How long until we give up on transmitting the message? | 34 | * How long until we give up on transmitting the message? |
35 | */ | 35 | */ |
36 | #define TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 300) | 36 | #define TIMEOUT GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_SECONDS, 300) |
37 | 37 | ||
38 | #define MAX_FILES 50 | 38 | #define MAX_FILES 50 |
39 | 39 | ||
@@ -44,32 +44,32 @@ static struct GNUNET_TRANSPORT_TESTING_ConnectCheckContext *ccc; | |||
44 | 44 | ||
45 | 45 | ||
46 | static void | 46 | static void |
47 | notify_receive (void *cls, | 47 | notify_receive(void *cls, |
48 | struct GNUNET_TRANSPORT_TESTING_PeerContext *receiver, | 48 | struct GNUNET_TRANSPORT_TESTING_PeerContext *receiver, |
49 | const struct GNUNET_PeerIdentity *sender, | 49 | const struct GNUNET_PeerIdentity *sender, |
50 | const struct GNUNET_TRANSPORT_TESTING_TestMessage *message) | 50 | const struct GNUNET_TRANSPORT_TESTING_TestMessage *message) |
51 | { | 51 | { |
52 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 52 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, |
53 | "Received message of type %d from peer %s!\n", | 53 | "Received message of type %d from peer %s!\n", |
54 | ntohs (message->header.type), | 54 | ntohs(message->header.type), |
55 | GNUNET_i2s (sender)); | 55 | GNUNET_i2s(sender)); |
56 | if ( (GNUNET_TRANSPORT_TESTING_SIMPLE_MTYPE == | 56 | if ((GNUNET_TRANSPORT_TESTING_SIMPLE_MTYPE == |
57 | ntohs (message->header.type)) && | 57 | ntohs(message->header.type)) && |
58 | (sizeof (struct GNUNET_TRANSPORT_TESTING_TestMessage) == | 58 | (sizeof(struct GNUNET_TRANSPORT_TESTING_TestMessage) == |
59 | ntohs (message->header.size)) ) | 59 | ntohs(message->header.size))) |
60 | { | 60 | { |
61 | ccc->global_ret = GNUNET_OK; | 61 | ccc->global_ret = GNUNET_OK; |
62 | } | 62 | } |
63 | else | 63 | else |
64 | { | 64 | { |
65 | GNUNET_break (0); | 65 | GNUNET_break(0); |
66 | } | 66 | } |
67 | GNUNET_SCHEDULER_shutdown (); | 67 | GNUNET_SCHEDULER_shutdown(); |
68 | } | 68 | } |
69 | 69 | ||
70 | 70 | ||
71 | int | 71 | int |
72 | main (int argc, char *argv[]) | 72 | main(int argc, char *argv[]) |
73 | { | 73 | { |
74 | struct GNUNET_TRANSPORT_TESTING_SendClosure sc = { | 74 | struct GNUNET_TRANSPORT_TESTING_SendClosure sc = { |
75 | .num_messages = 1 | 75 | .num_messages = 1 |
@@ -89,26 +89,26 @@ main (int argc, char *argv[]) | |||
89 | int res; | 89 | int res; |
90 | 90 | ||
91 | sc.ccc = &my_ccc; | 91 | sc.ccc = &my_ccc; |
92 | res = getrlimit (RLIMIT_NOFILE, | 92 | res = getrlimit(RLIMIT_NOFILE, |
93 | &r_file_old); | 93 | &r_file_old); |
94 | r_file_new.rlim_cur = MAX_FILES; | 94 | r_file_new.rlim_cur = MAX_FILES; |
95 | r_file_new.rlim_max = r_file_old.rlim_max; | 95 | r_file_new.rlim_max = r_file_old.rlim_max; |
96 | res = setrlimit (RLIMIT_NOFILE, | 96 | res = setrlimit(RLIMIT_NOFILE, |
97 | &r_file_new); | 97 | &r_file_new); |
98 | if (0 != res) | 98 | if (0 != res) |
99 | { | 99 | { |
100 | fprintf (stderr, | 100 | fprintf(stderr, |
101 | "Setting limit failed: %s\n", | 101 | "Setting limit failed: %s\n", |
102 | strerror (errno)); | 102 | strerror(errno)); |
103 | return 77; | 103 | return 77; |
104 | } | 104 | } |
105 | 105 | ||
106 | ccc = &my_ccc; | 106 | ccc = &my_ccc; |
107 | ccc->global_ret = GNUNET_SYSERR; | 107 | ccc->global_ret = GNUNET_SYSERR; |
108 | if (GNUNET_OK != | 108 | if (GNUNET_OK != |
109 | GNUNET_TRANSPORT_TESTING_main (2, | 109 | GNUNET_TRANSPORT_TESTING_main(2, |
110 | &GNUNET_TRANSPORT_TESTING_connect_check, | 110 | &GNUNET_TRANSPORT_TESTING_connect_check, |
111 | ccc)) | 111 | ccc)) |
112 | return 1; | 112 | return 1; |
113 | return 0; | 113 | return 0; |
114 | } | 114 | } |
@@ -118,10 +118,10 @@ main (int argc, char *argv[]) | |||
118 | 118 | ||
119 | 119 | ||
120 | int | 120 | int |
121 | main (int argc, char *argv[]) | 121 | main(int argc, char *argv[]) |
122 | { | 122 | { |
123 | fprintf (stderr, | 123 | fprintf(stderr, |
124 | "Cannot run test on this system\n"); | 124 | "Cannot run test on this system\n"); |
125 | return 77; | 125 | return 77; |
126 | } | 126 | } |
127 | 127 | ||