Skip to content

Commit 9945f33

Browse files
committed
Rename "rawsocket" module to "microsocket".
It's no longer intended to provide just "raw" socket interface, may include some convenience methods for compatibility with CPython socket - but anyway just minimal set required to deal with socket client and servers, not wider network functionality.
1 parent 0a587b8 commit 9945f33

File tree

5 files changed

+13
-13
lines changed

5 files changed

+13
-13
lines changed

examples/unix/sock-client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
try:
2-
import rawsocket as _socket
2+
import microsocket as _socket
33
except:
44
import _socket
55

examples/unix/sock-server.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
try:
2-
import rawsocket as socket
2+
import microsocket as socket
33
except:
44
import socket
55

unix/main.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323

2424
extern const mp_obj_fun_native_t mp_builtin_open_obj;
2525
void file_init();
26-
void rawsocket_init();
26+
void microsocket_init();
2727
void time_init();
2828
void ffi_init();
2929

@@ -265,7 +265,7 @@ int main(int argc, char **argv) {
265265
rt_store_name(qstr_from_str("qstr_info"), rt_make_function_n(0, qstr_info));
266266

267267
file_init();
268-
rawsocket_init();
268+
microsocket_init();
269269
#if MICROPY_MOD_TIME
270270
time_init();
271271
#endif

unix/qstrdefsport.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,4 @@ Q(htons)
1212
Q(inet_aton)
1313
Q(gethostbyname)
1414
Q(getaddrinfo)
15-
Q(rawsocket)
15+
Q(microsocket)

unix/socket.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ typedef struct _mp_obj_socket_t {
2424
int fd;
2525
} mp_obj_socket_t;
2626

27-
static const mp_obj_type_t rawsocket_type;
27+
static const mp_obj_type_t microsocket_type;
2828

2929
// Helper functions
3030
#define RAISE_ERRNO(err_flag, error_val) \
@@ -48,7 +48,7 @@ static void get_buffer(mp_obj_t obj, buffer_info_t *bufinfo) {
4848

4949
static mp_obj_socket_t *socket_new(int fd) {
5050
mp_obj_socket_t *o = m_new_obj(mp_obj_socket_t);
51-
o->base.type = &rawsocket_type;
51+
o->base.type = &microsocket_type;
5252
o->fd = fd;
5353
return o;
5454
}
@@ -208,7 +208,7 @@ static mp_obj_t socket_make_new(mp_obj_t type_in, uint n_args, uint n_kw, const
208208
return socket_new(fd);
209209
}
210210

211-
static const mp_method_t rawsocket_type_methods[] = {
211+
static const mp_method_t microsocket_type_methods[] = {
212212
{ "read", &mp_stream_read_obj },
213213
{ "readall", &mp_stream_readall_obj },
214214
{ "readline", &mp_stream_unbuffered_readline_obj},
@@ -228,7 +228,7 @@ static const mp_method_t rawsocket_type_methods[] = {
228228
{ NULL, NULL },
229229
};
230230

231-
static const mp_obj_type_t rawsocket_type = {
231+
static const mp_obj_type_t microsocket_type = {
232232
{ &mp_const_type },
233233
"socket",
234234
.print = socket_print,
@@ -239,7 +239,7 @@ static const mp_obj_type_t rawsocket_type = {
239239
.read = socket_read,
240240
.write = socket_write,
241241
},
242-
.methods = rawsocket_type_methods,
242+
.methods = microsocket_type_methods,
243243
};
244244

245245
static mp_obj_t mod_socket_htons(mp_obj_t arg) {
@@ -351,9 +351,9 @@ struct sym_entry {
351351

352352
#undef C
353353

354-
void rawsocket_init() {
355-
mp_obj_t m = mp_obj_new_module(MP_QSTR_rawsocket);
356-
rt_store_attr(m, MP_QSTR_socket, (mp_obj_t)&rawsocket_type);
354+
void microsocket_init() {
355+
mp_obj_t m = mp_obj_new_module(MP_QSTR_microsocket);
356+
rt_store_attr(m, MP_QSTR_socket, (mp_obj_t)&microsocket_type);
357357
#if MICROPY_SOCKET_EXTRA
358358
rt_store_attr(m, MP_QSTR_sockaddr_in, (mp_obj_t)&sockaddr_in_type);
359359
rt_store_attr(m, MP_QSTR_htons, (mp_obj_t)&mod_socket_htons_obj);

0 commit comments

Comments
 (0)