347 serverconfig_free(serverconf); |
347 serverconfig_free(serverconf); |
348 |
348 |
349 return serverconfig; |
349 return serverconfig; |
350 } |
350 } |
351 |
351 |
|
352 int migrate_server_conf(ServerConfiguration *old_cfg, ServerConfiguration *new_cfg) { |
|
353 // compare old/new listeners and set next listener, if they are using |
|
354 // the same socket |
|
355 CxIterator old_listeners = cxListIterator(old_cfg->listeners, 0); |
|
356 cx_foreach(HttpListener*, oldls, old_listeners) { |
|
357 if(oldls->next) { |
|
358 continue; |
|
359 } |
|
360 |
|
361 CxIterator new_listeners = cxListIterator(new_cfg->listeners, 0); |
|
362 cx_foreach(HttpListener*, newls, new_listeners) { |
|
363 if(http_listener_socket_eq(oldls, newls)) { |
|
364 oldls->next = newls; |
|
365 break; |
|
366 } |
|
367 } |
|
368 } |
|
369 |
|
370 return 0; |
|
371 } |
|
372 |
352 void cfg_ref(ServerConfiguration *cfg) { |
373 void cfg_ref(ServerConfiguration *cfg) { |
353 ws_atomic_inc32(&cfg->ref); |
374 ws_atomic_inc32(&cfg->ref); |
354 } |
375 } |
355 |
376 |
356 void cfg_unref(ServerConfiguration *cfg) { |
377 void cfg_unref(ServerConfiguration *cfg) { |