Set UDP dest port and not src port
This commit is contained in:
parent
bc8973b7e9
commit
e7b1b0b3c0
2 changed files with 2 additions and 2 deletions
|
@ -165,7 +165,7 @@ void on_tcp_read(struct evt_core_ctx* ctx, struct evt_core_fdinfo* fdinfo) {
|
|||
|
||||
// 3. A whole packet has been read, we will find someone to write it
|
||||
sprintf(url, "udp:write:127.0.0.1:%d", bp->ip.ap.str.port);
|
||||
printf("wil forwared to: %s\n", url);
|
||||
printf("wil be forwarded to: %s\n", url);
|
||||
to_fdinfo = evt_core_get_from_url (ctx, url);
|
||||
if (to_fdinfo == NULL) goto co_error;
|
||||
|
||||
|
@ -216,6 +216,7 @@ void on_udp_read(struct evt_core_ctx* ctx, struct evt_core_fdinfo* fdinfo) {
|
|||
if ((bp = get_read_buffer(app_ctx, fdinfo)) == NULL) return;
|
||||
|
||||
// 2. Read packet from socket
|
||||
bp->ip.ap.str.port = url_get_port_int (fdinfo->url);
|
||||
read_res = read_packet_from_udp (fdinfo->fd, bp);
|
||||
if (read_res == FDS_ERR) goto co_error;
|
||||
if (bp->mode != BP_WRITING) return;
|
||||
|
|
|
@ -94,7 +94,6 @@ enum FD_STATE read_packet_from_udp (int fd, struct buffer_packet* bp) {
|
|||
if (nread == -1 && errno == EAGAIN) return FDS_AGAIN;
|
||||
if (nread == -1) return FDS_ERR;
|
||||
|
||||
bp->ip.ap.str.port = ntohs(addr.sin_port);
|
||||
bp->ip.ap.str.size = nread + pkt_header_size;
|
||||
|
||||
bp->mode = BP_WRITING;
|
||||
|
|
Loading…
Reference in a new issue