// Copyright (c) 2016 Tristan Colgate-McFarlane // // This file is part of hugot. // // hugot is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // hugot is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with hugot. If not, see . package hugot import "context" // key is a our context key type type key int // ListenAndServe runs the handler h, passing all messages to/from // the provided adapter. The context may be used to gracefully shut // down the server. func ListenAndServe(ctx context.Context, h Handler, a Adapter, as ...Adapter) { if h == nil { h = DefaultMux } ctx = NewAdapterContext(ctx, a) Loop(ctx, h, a, as...) }