Changeset 5be5396 in mainline


Ignore:
Timestamp:
2024-10-11T16:08:55Z (3 months ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
master
Children:
b3b79981
Parents:
fb06afd
Message:

Remcons needs to properly clean up when terminating a user session

Location:
uspace
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/console/src/con_srv.c

    rfb06afd r5be5396  
    466466                }
    467467
    468                 if (!received)
     468                if (!received || srv->srvs->aborted)
    469469                        break;
    470470
  • uspace/lib/vt/include/vt/vt100.h

    rfb06afd r5be5396  
    179179extern void vt100_set_pos(vt100_t *, sysarg_t, sysarg_t);
    180180extern void vt100_goto(vt100_t *, sysarg_t, sysarg_t);
     181extern void vt100_sgr(vt100_t *, unsigned int);
    181182extern void vt100_set_sgr(vt100_t *, char_attrs_t);
    182183extern void vt100_set_attr(vt100_t *, char_attrs_t);
  • uspace/lib/vt/src/vt100.c

    rfb06afd r5be5396  
    6666 * @param mode SGR mode number
    6767 */
    68 static void vt100_sgr(vt100_t *vt, unsigned int mode)
     68void vt100_sgr(vt100_t *vt, unsigned int mode)
    6969{
    7070        char control[MAX_CONTROL];
  • uspace/srv/hid/remcons/remcons.c

    rfb06afd r5be5396  
    739739        user->srvs.ops = &con_ops;
    740740        user->srvs.sarg = remcons;
    741         user->srvs.abort_timeout = 1000;
     741        user->srvs.abort_timeout = 1000000;
    742742
    743743        telnet_user_add(user);
     
    765765        while (!user_can_be_destroyed_no_lock(user)) {
    766766                if (user->task_finished) {
    767                         user->conn = NULL;
    768767                        user->socket_closed = true;
    769768                        user->srvs.aborted = true;
    770                         continue;
    771769                } else if (user->socket_closed) {
    772770                        if (user->task_id != 0) {
     
    774772                        }
    775773                }
    776                 fibril_condvar_wait_timeout(&user->refcount_cv, &user->recv_lock, 1000);
     774                fibril_condvar_wait_timeout(&user->refcount_cv,
     775                    &user->recv_lock, 1000000);
    777776        }
    778777        fibril_mutex_unlock(&user->recv_lock);
     
    786785
    787786        telnet_user_log(user, "Destroying...");
     787
     788        if (remcons->enable_ctl) {
     789                /* Disable mouse tracking */
     790                vt100_set_button_reporting(remcons->vt, false);
     791
     792                /* Reset all character attributes and clear screen */
     793                vt100_sgr(remcons->vt, 0);
     794                vt100_cls(remcons->vt);
     795                vt100_set_pos(remcons->vt, 0, 0);
     796
     797                telnet_user_flush(user);
     798        }
     799
     800        tcp_conn_send_fin(user->conn);
     801        user->conn = NULL;
     802
    788803        telnet_user_destroy(user);
     804        vt100_destroy(remcons->vt);
     805        free(remcons);
    789806        return;
    790807error:
Note: See TracChangeset for help on using the changeset viewer.