uncensored.
The race was that a new connection could begin doing its greeting
function and another thread could begin the connections command loop
function before the greeting had completed setting up the connection
environment.
*/
enum {
CON_IDLE, /* This context is doing nothing */
- CON_STARTING, /* This context needs the greeting outputting */
+ CON_GREETING, /* This context needs to output its greeting */
+ CON_STARTING, /* This context is outputting its greeting */
CON_READY, /* This context needs attention */
CON_EXECUTING /* This context is bound to a thread */
};
ptr->state = CON_EXECUTING;
break;
}
- if ((bind_me == NULL) && (ptr->state == CON_STARTING)) {
+ if ((bind_me == NULL) && (ptr->state == CON_GREETING)) {
bind_me = ptr;
+ ptr->state = CON_STARTING;
break;
}
}
SO_REUSEADDR,
&i, sizeof(i));
- con->state = CON_STARTING;
+ con->state = CON_GREETING;
retval--;
if (retval == 0)