Skip to content

Commit 0368271

Browse files
author
someguy
committed
Use the term 'protocol' everywhere, instad of socket_type.
1 parent 0b5c1d7 commit 0368271

File tree

5 files changed

+19
-19
lines changed

5 files changed

+19
-19
lines changed

src/netlog/netlog-conf.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ int config_parse_netlog_remote_address(const char *unit,
3434
return 0;
3535
}
3636

37-
int config_parse_socket_type(const char *unit,
37+
int config_parse_protocol(const char *unit,
3838
const char *filename,
3939
unsigned line,
4040
const char *section,
@@ -52,12 +52,12 @@ int config_parse_socket_type(const char *unit,
5252
assert(data);
5353

5454
if (strcaseeq(rvalue, "tcp"))
55-
m->socket_type = SOCK_STREAM;
55+
m->protocol = SOCK_STREAM;
5656
else if (strcaseeq(rvalue, "udp"))
57-
m->socket_type = SOCK_DGRAM;
57+
m->protocol = SOCK_DGRAM;
5858
else {
5959
log_syntax(unit, LOG_ERR, filename, line, EINVAL,
60-
"Unrecognised socket type '%s'; should be either 'tcp' or 'udp'", rvalue);
60+
"Unrecognised protocol '%s'; should be either 'tcp' or 'udp'", rvalue);
6161
return -EINVAL;
6262
}
6363

src/netlog/netlog-conf.h

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,14 @@ int config_parse_netlog_remote_address(const char *unit,
1717
const char *rvalue,
1818
void *data,
1919
void *userdata);
20-
int config_parse_socket_type(const char *unit,
21-
const char *filename,
22-
unsigned line,
23-
const char *section,
24-
unsigned section_line,
25-
const char *lvalue,
26-
int ltype,
27-
const char *rvalue,
28-
void *data,
29-
void *userdata);
20+
int config_parse_protocol(const char *unit,
21+
const char *filename,
22+
unsigned line,
23+
const char *section,
24+
unsigned section_line,
25+
const char *lvalue,
26+
int ltype,
27+
const char *rvalue,
28+
void *data,
29+
void *userdata);
3030
int manager_parse_config_file(Manager *m);

src/netlog/netlog-gperf.gperf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,5 @@ struct ConfigPerfItem;
1616
%includes
1717
%%
1818
Network.Address, config_parse_netlog_remote_address, 0, 0
19-
Network.Protocol, config_parse_socket_type, 0, offsetof(Manager, socket_type)
19+
Network.Protocol, config_parse_protocol, 0, offsetof(Manager, protocol)
2020
Network.StructuredData, config_parse_string, 0, offsetof(Manager, structured_data)

src/netlog/netlog-manager.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ struct Manager {
3333

3434
char *last_cursor, *current_cursor;
3535
char *structured_data;
36-
int socket_type;
36+
int protocol;
3737
};
3838

3939
int manager_new(Manager **ret, const char *state_file, const char *cursor);

src/netlog/netlog-network.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ int manager_push_to_network(Manager *m,
154154
IOVEC_SET_STRING(iov[n++], message);
155155

156156
/* Tenth: Newline message separator, if not implicitly terminated by end of UDP frame */
157-
if (m->socket_type == SOCK_DGRAM)
157+
if (m->protocol == SOCK_DGRAM)
158158
IOVEC_SET_STRING(iov[n++], "\n");
159159

160160
return network_send(m, iov, n);
@@ -175,7 +175,7 @@ int manager_open_network_socket(Manager *m) {
175175
if (!IN_SET(m->address.sockaddr.sa.sa_family, AF_INET, AF_INET6))
176176
return -EAFNOSUPPORT;
177177

178-
m->socket = socket(m->address.sockaddr.sa.sa_family, m->socket_type|SOCK_CLOEXEC, 0);
178+
m->socket = socket(m->address.sockaddr.sa.sa_family, m->protocol|SOCK_CLOEXEC, 0);
179179
if (m->socket < 0)
180180
return -errno;
181181

@@ -185,7 +185,7 @@ int manager_open_network_socket(Manager *m) {
185185
goto fail;
186186
}
187187

188-
if (SOCK_STREAM == m->socket_type) {
188+
if (SOCK_STREAM == m->protocol) {
189189
union sockaddr_union sa;
190190
socklen_t salen;
191191
switch (m->address.sockaddr.sa.sa_family) {

0 commit comments

Comments
 (0)