Changes in uspace/srv/hid/remcons/user.c [5d94b16c:fab2746] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/hid/remcons/user.c
r5d94b16c rfab2746 38 38 #include <str_error.h> 39 39 #include <loc.h> 40 #include <event.h>41 40 #include <io/keycode.h> 42 41 #include <align.h> … … 45 44 #include <fibril_synch.h> 46 45 #include <task.h> 47 #include <net/in.h> 48 #include <net/inet.h> 49 #include <net/socket.h> 46 #include <inet/tcp.h> 50 47 #include <io/console.h> 51 48 #include <inttypes.h> … … 59 56 /** Create new telnet user. 60 57 * 61 * @param socket Socket the user communicates through.58 * @param conn Incoming connection. 62 59 * @return New telnet user or NULL when out of memory. 63 60 */ 64 telnet_user_t *telnet_user_create( int socket)61 telnet_user_t *telnet_user_create(tcp_conn_t *conn) 65 62 { 66 63 static int telnet_user_id_counter = 0; … … 79 76 } 80 77 81 user-> socket = socket;78 user->conn = conn; 82 79 user->service_id = (service_id_t) -1; 83 80 prodcons_initialize(&user->in_events); … … 128 125 129 126 fibril_mutex_lock(&users_guard); 130 list_foreach(users, link) { 131 telnet_user_t *tmp = list_get_instance(link, telnet_user_t, link); 127 list_foreach(users, link, telnet_user_t, tmp) { 132 128 if (tmp->service_id == id) { 133 129 user = tmp; … … 195 191 /* No more buffered data? */ 196 192 if (user->socket_buffer_len <= user->socket_buffer_pos) { 197 int recv_length = recv(user->socket, user->socket_buffer, BUFFER_SIZE, 0); 198 if ((recv_length == 0) || (recv_length == ENOTCONN)) { 193 int rc; 194 size_t recv_length; 195 196 rc = tcp_conn_recv_wait(user->conn, user->socket_buffer, 197 BUFFER_SIZE, &recv_length); 198 if (rc != EOK) 199 return rc; 200 201 if (recv_length == 0) { 199 202 user->socket_closed = true; 200 203 user->srvs.aborted = true; 201 204 return ENOENT; 202 205 } 203 if (recv_length < 0) { 204 return recv_length; 205 } 206 206 207 user->socket_buffer_len = recv_length; 207 208 user->socket_buffer_pos = 0; … … 361 362 362 363 363 int rc = send(user->socket, converted, converted_size, 0);364 int rc = tcp_conn_send(user->conn, converted, converted_size); 364 365 free(converted); 365 366
Note:
See TracChangeset
for help on using the changeset viewer.