| 1227 | */ |
| 1228 | |
| 1229 | static bool login_connection(THD *thd) |
| 1230 | { |
| 1231 | NET *net= &thd->net; |
| 1232 | int error= 0; |
| 1233 | DBUG_ENTER("login_connection"); |
| 1234 | DBUG_PRINT("info", ("login_connection called by thread %lu", |
| 1235 | (ulong) thd->thread_id)); |
| 1236 | |
| 1237 | /* Use "connect_timeout" value during connection phase */ |
| 1238 | my_net_set_read_timeout(net, connect_timeout); |
| 1239 | my_net_set_write_timeout(net, connect_timeout); |
| 1240 | |
| 1241 | error= check_connection(thd); |
| 1242 | thd->protocol->end_statement(); |
| 1243 | |
| 1244 | if (unlikely(error)) |
| 1245 | { // Wrong permissions |
| 1246 | #ifdef _WIN32 |
| 1247 | if (vio_type(net->vio) == VIO_TYPE_NAMEDPIPE) |
| 1248 | my_sleep(1000); /* must wait after eof() */ |
| 1249 | #endif |
| 1250 | statistic_increment(aborted_connects,&LOCK_status); |
| 1251 | error=1; |
| 1252 | goto exit; |
| 1253 | } |
| 1254 | /* Connect completed, set read/write timeouts back to default */ |
| 1255 | my_net_set_read_timeout(net, thd->variables.net_read_timeout); |
| 1256 | my_net_set_write_timeout(net, thd->variables.net_write_timeout); |
| 1257 | |
| 1258 | /* Updates global user connection stats. */ |
| 1259 | if (increment_connection_count(thd)) |
| 1260 | { |
| 1261 | my_error(ER_OUTOFMEMORY, MYF(0), (int) (2*sizeof(USER_STATS))); |
| 1262 | error= 1; |
| 1263 | goto exit; |
| 1264 | } |
| 1265 | |
| 1266 | exit: |
| 1267 | mysql_audit_notify_connection_connect(thd); |
| 1268 | DBUG_RETURN(error); |
| 1269 | } |
| 1270 | |
| 1271 | |
| 1272 | /* |
no test coverage detected