@@ -112,7 +112,7 @@ fn create_server_socket(port int) int {
112
112
server_fd := C.socket (C.AF_INET, C.SOCK_STREAM, 0 )
113
113
if server_fd < 0 {
114
114
eprintln (@LOCATION)
115
- C.perror ('Socket creation failed' .str )
115
+ C.perror (c 'Socket creation failed' )
116
116
return - 1
117
117
}
118
118
@@ -122,7 +122,7 @@ fn create_server_socket(port int) int {
122
122
opt := 1
123
123
if C.setsockopt (server_fd, C.SOL_SOCKET, C.SO_REUSEPORT, & opt, sizeof (opt)) < 0 {
124
124
eprintln (@LOCATION)
125
- C.perror ('setsockopt SO_REUSEPORT failed' .str )
125
+ C.perror (c 'setsockopt SO_REUSEPORT failed' )
126
126
close_socket (server_fd)
127
127
return - 1
128
128
}
@@ -136,13 +136,13 @@ fn create_server_socket(port int) int {
136
136
137
137
if C.bind (server_fd, voidptr (& server_addr), sizeof (server_addr)) < 0 {
138
138
eprintln (@LOCATION)
139
- C.perror ('Bind failed' .str )
139
+ C.perror (c 'Bind failed' )
140
140
close_socket (server_fd)
141
141
return - 1
142
142
}
143
143
if C.listen (server_fd, max_connection_size) < 0 {
144
144
eprintln (@LOCATION)
145
- C.perror ('Listen failed' .str )
145
+ C.perror (c 'Listen failed' )
146
146
close_socket (server_fd)
147
147
return - 1
148
148
}
@@ -157,7 +157,7 @@ fn add_fd_to_epoll(epoll_fd int, fd int, events u32) int {
157
157
ev.data.fd = fd
158
158
if C.epoll_ctl (epoll_fd, C.EPOLL_CTL_ADD, fd, & ev) == - 1 {
159
159
eprintln (@LOCATION)
160
- C.perror ('epoll_ctl' .str )
160
+ C.perror (c 'epoll_ctl' )
161
161
return - 1
162
162
}
163
163
return 0
@@ -178,7 +178,7 @@ fn handle_accept_loop(mut server Server) {
178
178
}
179
179
180
180
eprintln (@LOCATION)
181
- C.perror ('Accept failed' .str )
181
+ C.perror (c 'Accept failed' )
182
182
return
183
183
}
184
184
@@ -263,7 +263,7 @@ fn (mut server Server) run() {
263
263
for i := 0 ; i < max_thread_pool_size; i++ {
264
264
server.epoll_fds[i] = C.epoll_create1 (0 )
265
265
if server.epoll_fds[i] < 0 {
266
- C.perror ('epoll_create1 failed' .str )
266
+ C.perror (c 'epoll_create1 failed' )
267
267
close_socket (server.socket_fd)
268
268
return
269
269
}
0 commit comments