Hi Tuomas,

On 11-06-13 17:49, Tuomas Räsänen wrote:
> Signed-off-by: Tuomas Räsänen <[email protected]>
> ---
>  nbd-server.c |   16 +++++++---------
>  1 file changed, 7 insertions(+), 9 deletions(-)

This still failed to apply cleanly; I'm not sure why. I just applied it
manually instead, by copy/pasting from the patch.

The other two in this batch weren't problematic.

> diff --git a/nbd-server.c b/nbd-server.c
> index 9b529ae..944ee69 100644
> --- a/nbd-server.c
> +++ b/nbd-server.c
> @@ -2354,12 +2354,17 @@ handler_err:
>  }
>  
>  static void
> -handle_oldstyle_connection(GArray *servers, int net, SERVER *serve)
> +handle_oldstyle_connection(GArray *servers, int sock, SERVER *serve)
>  {
> +     int net;
>       CLIENT *client = NULL;
>       int sock_flags_old;
>       int sock_flags_new;
>  
> +     net = socket_accept(sock);
> +     if (net < 0)
> +             return;
> +
>       if(serve->max_connections > 0 &&
>          g_hash_table_size(children) >= serve->max_connections) {
>               msg(LOG_INFO, "Max connections reached");
> @@ -2517,8 +2522,6 @@ out:
>   * Loop through the available servers, and serve them. Never returns.
>   **/
>  void serveloop(GArray* servers) {
> -     struct sockaddr_storage addrin;
> -     socklen_t addrinlen=sizeof(addrin);
>       int i;
>       int max;
>       fd_set mset;
> @@ -2592,7 +2595,6 @@ void serveloop(GArray* servers) {
>                               handle_modern_connection(servers, sock);
>                       }
>                       for(i=0; i < servers->len; i++) {
> -                             int net;
>                               SERVER *serve;
>  
>                               serve=&(g_array_index(servers, SERVER, i));
> @@ -2600,11 +2602,7 @@ void serveloop(GArray* servers) {
>                                       continue;
>                               }
>                               if(FD_ISSET(serve->socket, &rset)) {
> -                                     if ((net=accept(serve->socket, (struct 
> sockaddr *) &addrin, &addrinlen)) < 0) {
> -                                             err_nonfatal("accept: %m");
> -                                             continue;
> -                                     }
> -                                     handle_oldstyle_connection(servers, 
> net, serve);
> +                                     handle_oldstyle_connection(servers, 
> serve->socket, serve);
>                               }
>                       }
>               }
> 

-- 
This end should point toward the ground if you want to go to space.

If it starts pointing toward space you are having a bad problem and you
will not go to space today.

  -- http://xkcd.com/1133/

------------------------------------------------------------------------------
This SF.net email is sponsored by Windows:

Build for Windows Store.

http://p.sf.net/sfu/windows-dev2dev
_______________________________________________
Nbd-general mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/nbd-general

Reply via email to